| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* Dog.cpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* 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 ---------------------------------
- */
- /* ************************************************************************** */
|