cpp/CPP04/ex01/Dog.cpp
2024-12-04 17:29:31 +01:00

30 lines
508 B
C++

#include "Dog.hpp"
Dog::Dog() : Animal() {
std::cout << "Dog born" << std::endl;
this->type = "Dog";
this->brain = new Brain();
}
Dog::Dog(const Dog &other) : Animal() {
this->brain = new Brain();
*this = other;
}
Dog& Dog::operator=(const Dog &other) {
if (this != &other) {
this->type = other.type;
*this->brain = *other.brain;
}
return (*this);
}
Dog::~Dog() {
std::cout << "Dog die" << std::endl;
delete this->brain;
}
void Dog::makeSound() const {
std::cout << "Waf" << std::endl;
}