CPP04 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
WrongCat.cpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* WrongCat.cpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/05/20 16:27:33 by kamitsui #+# #+# */
9/* Updated: 2025/05/20 23:17:54 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
21#include "WrongCat.hpp"
22
29 this->type = "WrongCat";
30 std::cout << "WrongCat default constructor called" << std::endl;
31}
32
39WrongCat::WrongCat(const WrongCat &other) : WrongAnimal(other) {
40 std::cout << "WrongCat copy constructor called" << std::endl;
41}
42
52 std::cout << "WrongCat copy assignment operator called" << std::endl;
53 if (this != &other) {
55 }
56 return *this;
57}
58
63WrongCat::~WrongCat() { std::cout << "WrongCat destructor called" << std::endl; }
64
73void WrongCat::makeSound() const { std::cout << "Wrong meow!" << std::endl; }
The WrongAnimal class represents a generic animal, used to demonstrate the LACK of polymorphism when ...
WrongAnimal & operator=(const WrongAnimal &other)
Copy assignment operator for WrongAnimal. Assigns the type from the other WrongAnimal object....
The WrongCat class represents a feline animal in the "wrong" hierarchy.
Definition WrongCat.hpp:34
WrongCat()
Default constructor for WrongCat. Calls the WrongAnimal base class constructor and sets the type to "...
Definition WrongCat.cpp:28
virtual ~WrongCat()
Destructor for WrongCat. Displays a specific destruction message.
Definition WrongCat.cpp:63
WrongCat & operator=(const WrongCat &other)
Makes the characteristic sound of a WrongCat ("Wrong meow!").
Definition WrongCat.cpp:51
void makeSound() const
Makes the characteristic sound of a WrongCat ("Wrong meow!").
Definition WrongCat.cpp:73
T endl(T... args)
Declares the WrongCat class.