/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Dog.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bchanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/12/18 16:27:49 by bchanot #+# #+# */ /* Updated: 2025/12/18 18:51:01 by bchanot ### ########.fr */ /* */ /* ************************************************************************** */ #include "Dog.hpp" /* ** ------------------------------- CONSTRUCTOR -------------------------------- */ Dog::Dog() : AAnimal("Dog"), _brain(new Brain()) { std::cout << "A Dog is born !" << std::endl; } Dog::Dog( const Dog & src ) : AAnimal(src), _brain(new Brain(*src._brain)) { std::cout << "A " << this->type << " is born !" << std::endl; } /* ** -------------------------------- DESTRUCTOR -------------------------------- */ Dog::~Dog() { delete this->_brain; std::cout << "A " << this->type << " has died ..." << std::endl; } /* ** --------------------------------- OVERLOAD --------------------------------- */ Dog & Dog::operator=( Dog const & rhs ) { (void)rhs; if ( this != &rhs ) { delete this->_brain; AAnimal::operator=(rhs); this->_brain = new Brain(*rhs._brain); } return *this; } std::ostream & operator<<( std::ostream & o, Dog const & i ) { (void)i; //o << "Value = " << i.getValue(); return o; } /* ** --------------------------------- METHODS ---------------------------------- */ void Dog::makeSound(void) const { std::cout << "*Waf Waf*" << std::endl; } /* ** --------------------------------- ACCESSOR --------------------------------- */ /* ************************************************************************** */