| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* Animal.cpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* 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;
- }
- /* ************************************************************************** */
|