CPP04 1.0
|
The WrongCat class represents a feline animal in the "wrong" hierarchy. [詳解]
#include <WrongCat.hpp>
公開メンバ関数 | |
WrongCat () | |
Default constructor for WrongCat. Calls the WrongAnimal base class constructor and sets the type to "WrongCat". Displays a specific construction message. | |
WrongCat (const WrongCat &other) | |
Copy constructor for WrongCat. Calls the WrongAnimal base class copy constructor. Displays a specific copy construction message. | |
WrongCat & | operator= (const WrongCat &other) |
Makes the characteristic sound of a WrongCat ("Wrong meow!"). | |
virtual | ~WrongCat () |
Destructor for WrongCat. Displays a specific destruction message. | |
void | makeSound () const |
Makes the characteristic sound of a WrongCat ("Wrong meow!"). | |
WrongCat () | |
WrongCat (const WrongCat &other) | |
WrongCat & | operator= (const WrongCat &other) |
virtual | ~WrongCat () |
void | makeSound () const |
WrongCat () | |
WrongCat (const WrongCat &other) | |
WrongCat & | operator= (const WrongCat &other) |
virtual | ~WrongCat () |
void | makeSound () const |
![]() | |
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 WrongCat class represents a feline animal in the "wrong" hierarchy.
This class inherits from WrongAnimal and attempts to provide its own sound. However, due to makeSound() in WrongAnimal not being virtual, the specific WrongCat::makeSound() will NOT be called polymorphically when accessed via a WrongAnimal pointer.
WrongCat.hpp の 34 行目に定義があります。
WrongCat::WrongCat | ( | ) |
Default constructor for WrongCat. Calls the WrongAnimal base class constructor and sets the type to "WrongCat". Displays a specific construction message.
WrongCat.cpp の 28 行目に定義があります。
WrongCat::WrongCat | ( | const WrongCat & | other | ) |
Copy constructor for WrongCat. Calls the WrongAnimal base class copy constructor. Displays a specific copy construction message.
other | The WrongCat object to copy from. |
WrongCat.cpp の 39 行目に定義があります。
|
virtual |
Destructor for WrongCat. Displays a specific destruction message.
WrongCat.cpp の 63 行目に定義があります。
WrongCat::WrongCat | ( | ) |
WrongCat::WrongCat | ( | const WrongCat & | other | ) |
|
virtual |
WrongCat::WrongCat | ( | ) |
WrongCat::WrongCat | ( | const WrongCat & | other | ) |
|
virtual |
void WrongCat::makeSound | ( | ) | const |
Makes the characteristic sound of a WrongCat ("Wrong meow!").
This function attempts to override makeSound(), but because the base WrongAnimal::makeSound() is not virtual, this specific implementation will only be called when invoked directly on a WrongCat object, not polymorphically through a WrongAnimal pointer.
WrongCat.cpp の 73 行目に定義があります。
void WrongCat::makeSound | ( | ) | const |
void WrongCat::makeSound | ( | ) | const |
Makes the characteristic sound of a WrongCat ("Wrong meow!").
This function attempts to override makeSound(), but because the base WrongAnimal::makeSound() is not virtual, this specific implementation will only be called when invoked directly on a WrongCat object, not polymorphically through a WrongAnimal pointer.
WrongCat.cpp の 51 行目に定義があります。