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