30 lines
510 B
C++
30 lines
510 B
C++
#include "Cat.hpp"
|
|
|
|
Cat::Cat() : Animal() {
|
|
std::cout << "Cat born" << std::endl;
|
|
this->type = "Cat";
|
|
this->brain = new Brain();
|
|
}
|
|
|
|
Cat::Cat(const Cat &other) : Animal() {
|
|
this->brain = new Brain();
|
|
*this = other;
|
|
}
|
|
|
|
Cat& Cat::operator=(const Cat &other) {
|
|
if (this != &other) {
|
|
this->type = other.type;
|
|
*this->brain = *other.brain;
|
|
}
|
|
return (*this);
|
|
}
|
|
|
|
Cat::~Cat() {
|
|
std::cout << "Cat die" << std::endl;
|
|
delete this->brain;
|
|
}
|
|
|
|
void Cat::makeSound() const {
|
|
std::cout << "Miaou" << std::endl;
|
|
}
|