CPP04 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
WrongAnimal クラス

The WrongAnimal class represents a generic animal, used to demonstrate the LACK of polymorphism when member functions are NOT declared virtual. [詳解]

#include <WrongAnimal.hpp>

WrongAnimal の継承関係図
Inheritance graph
WrongAnimal 連携図
Collaboration graph

公開メンバ関数

 WrongAnimal ()
 Default constructor for WrongAnimal. Initializes the type to "Generic WrongAnimal". Displays a construction message for clarity.
 
 WrongAnimal (const WrongAnimal &other)
 Copy constructor for WrongAnimal. Copies the type from the other WrongAnimal object. Displays a copy construction message.
 
WrongAnimal & operator= (const WrongAnimal &other)
 Copy assignment operator for WrongAnimal. Assigns the type from the other WrongAnimal object. Handles self-assignment to prevent issues. Displays a copy assignment message.
 
virtual ~WrongAnimal ()
 Destructor for WrongAnimal. Displays a destruction message. Note: Declared virtual in the header to ensure proper cleanup even if makeSound() isn't virtual.
 
void makeSound () const
 Makes a generic sound for a WrongAnimal. This function is intentionally NOT VIRTUAL to show the lack of runtime polymorphism when called via a base class pointer.
 
const std::string & getType () const
 Gets the type of the WrongAnimal.
 
 WrongAnimal ()
 
 WrongAnimal (const WrongAnimal &other)
 
WrongAnimal & operator= (const WrongAnimal &other)
 
virtual ~WrongAnimal ()
 
void makeSound () const
 
const std::string & getType () const
 
 WrongAnimal ()
 
 WrongAnimal (const WrongAnimal &other)
 
WrongAnimal & operator= (const WrongAnimal &other)
 
virtual ~WrongAnimal ()
 
void makeSound () const
 
const std::string & getType () const
 

限定公開変数類

std::string type
 

詳解

The WrongAnimal class represents a generic animal, used to demonstrate the LACK of polymorphism when member functions are NOT declared virtual.

This class is intentionally designed to show the difference in behavior compared to the Animal class regarding virtual functions.

WrongAnimal.hpp の 35 行目に定義があります。

構築子と解体子

◆ WrongAnimal() [1/6]

WrongAnimal::WrongAnimal ( )

Default constructor for WrongAnimal. Initializes the type to "Generic WrongAnimal". Displays a construction message for clarity.

WrongAnimal.cpp の 28 行目に定義があります。

◆ WrongAnimal() [2/6]

WrongAnimal::WrongAnimal ( const WrongAnimal &  other)

Copy constructor for WrongAnimal. Copies the type from the other WrongAnimal object. Displays a copy construction message.

引数
otherThe WrongAnimal object to copy from.

WrongAnimal.cpp の 38 行目に定義があります。

◆ ~WrongAnimal() [1/3]

WrongAnimal::~WrongAnimal ( )
virtual

Destructor for WrongAnimal. Displays a destruction message. Note: Declared virtual in the header to ensure proper cleanup even if makeSound() isn't virtual.

WrongAnimal.cpp の 64 行目に定義があります。

◆ WrongAnimal() [3/6]

WrongAnimal::WrongAnimal ( )

◆ WrongAnimal() [4/6]

WrongAnimal::WrongAnimal ( const WrongAnimal &  other)

◆ ~WrongAnimal() [2/3]

virtual WrongAnimal::~WrongAnimal ( )
virtual

◆ WrongAnimal() [5/6]

WrongAnimal::WrongAnimal ( )

◆ WrongAnimal() [6/6]

WrongAnimal::WrongAnimal ( const WrongAnimal &  other)

◆ ~WrongAnimal() [3/3]

virtual WrongAnimal::~WrongAnimal ( )
virtual

関数詳解

◆ getType() [1/3]

const std::string & WrongAnimal::getType ( ) const

Gets the type of the WrongAnimal.

戻り値
A const reference to the wrong animal's type string.

WrongAnimal.cpp の 77 行目に定義があります。

◆ getType() [2/3]

const std::string & WrongAnimal::getType ( ) const

◆ getType() [3/3]

const std::string & WrongAnimal::getType ( ) const

◆ makeSound() [1/3]

void WrongAnimal::makeSound ( ) const

Makes a generic sound for a WrongAnimal. This function is intentionally NOT VIRTUAL to show the lack of runtime polymorphism when called via a base class pointer.

WrongAnimal.cpp の 71 行目に定義があります。

◆ makeSound() [2/3]

void WrongAnimal::makeSound ( ) const

◆ makeSound() [3/3]

void WrongAnimal::makeSound ( ) const

◆ operator=() [1/3]

WrongAnimal & WrongAnimal::operator= ( const WrongAnimal &  other)

Copy assignment operator for WrongAnimal. Assigns the type from the other WrongAnimal object. Handles self-assignment to prevent issues. Displays a copy assignment message.

引数
otherThe WrongAnimal object to assign from.
戻り値
A reference to the assigned WrongAnimal object.

WrongAnimal.cpp の 50 行目に定義があります。

◆ operator=() [2/3]

WrongAnimal & WrongAnimal::operator= ( const WrongAnimal &  other)

◆ operator=() [3/3]

WrongAnimal & WrongAnimal::operator= ( const WrongAnimal &  other)

メンバ詳解

◆ type

std::string WrongAnimal::type
protected

WrongAnimal.hpp の 37 行目に定義があります。


このクラス詳解は次のファイルから抽出されました: