| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* Cat.cpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2025/12/18 16:28:27 by bchanot #+# #+# */
- /* Updated: 2025/12/18 18:21:47 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include "Cat.hpp"
- /*
- ** ------------------------------- CONSTRUCTOR --------------------------------
- */
- Cat::Cat() : Animal("Cat"), _brain(new Brain())
- {
- std::cout << "A Cat is born !" << std::endl;
- }
- Cat::Cat( const Cat & src ) : Animal(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;
- Animal::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 ---------------------------------
- */
- /* ************************************************************************** */
|