CPP04 1.0
|
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 () | |
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::WrongAnimal | ( | ) |
Default constructor for WrongAnimal. Initializes the type to "Generic WrongAnimal". Displays a construction message for clarity.
WrongAnimal.cpp の 28 行目に定義があります。
WrongAnimal::WrongAnimal | ( | const WrongAnimal & | other | ) |
Copy constructor for WrongAnimal. Copies the type from the other WrongAnimal object. Displays a copy construction message.
other | The WrongAnimal object to copy from. |
WrongAnimal.cpp の 38 行目に定義があります。
|
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::WrongAnimal | ( | ) |
WrongAnimal::WrongAnimal | ( | const WrongAnimal & | other | ) |
|
virtual |
WrongAnimal::WrongAnimal | ( | ) |
WrongAnimal::WrongAnimal | ( | const WrongAnimal & | other | ) |
|
virtual |
const std::string & WrongAnimal::getType | ( | ) | const |
Gets the type of the WrongAnimal.
WrongAnimal.cpp の 77 行目に定義があります。
const std::string & WrongAnimal::getType | ( | ) | const |
const std::string & WrongAnimal::getType | ( | ) | const |
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 行目に定義があります。
void WrongAnimal::makeSound | ( | ) | const |
void WrongAnimal::makeSound | ( | ) | const |
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.
other | The WrongAnimal object to assign from. |
WrongAnimal.cpp の 50 行目に定義があります。
WrongAnimal & WrongAnimal::operator= | ( | const WrongAnimal & | other | ) |
WrongAnimal & WrongAnimal::operator= | ( | const WrongAnimal & | other | ) |
|
protected |
WrongAnimal.hpp の 37 行目に定義があります。