/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Animal.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bchanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/12/18 16:26:41 by bchanot #+# #+# */ /* Updated: 2025/12/18 17:02:51 by bchanot ### ########.fr */ /* */ /* ************************************************************************** */ #include "Animal.hpp" /* ** ------------------------------- CONSTRUCTOR -------------------------------- */ Animal::Animal() : type("Default") { std::cout << "An animal type Default is born." << std::endl; } Animal::Animal( std::string const & type ) : type(type) { std::cout << "An animal type " << this->type << " Is born." << std::endl; } Animal::Animal( const Animal & src ) : type(src.type) { std::cout << "An animal type " << this->type << " Is born." << std::endl; } /* ** -------------------------------- DESTRUCTOR -------------------------------- */ Animal::~Animal() { std::cout << "An animal type " << this->type << " has died..." << std::endl; } /* ** --------------------------------- OVERLOAD --------------------------------- */ Animal & Animal::operator=( Animal const & rhs ) { if ( this != &rhs ) { this->type = rhs.type; } return *this; } std::ostream & operator<<( std::ostream & o, Animal const & i ) { (void)i; //o << "Value = " << i.getValue(); return o; } /* ** --------------------------------- METHODS ---------------------------------- */ void Animal::makeSound(void) const { std::cout << "*An undefined animal noise*" << std::endl; } /* ** --------------------------------- ACCESSOR --------------------------------- */ std::string Animal::getType(void) const { return this->type; } /* ************************************************************************** */