Files
42_INT_09_piscine_cpp/d04/ex01/srcs/Animal.cpp

53 lines
1.1 KiB
C++

#include "Animal.hpp"
#define COPLIEN_COLOR B_CYAN
/*********************************************
* CONSTRUCTORS
*********************************************/
Animal::Animal() {
std::cout << COPLIEN_COLOR "Animal constructor" RESET "\n";
type = "animal";
return;
}
Animal::Animal( Animal const & src ) {
std::cout << COPLIEN_COLOR "Animal copy constructor" RESET "\n";
*this = src;
return;
}
/*********************************************
* DESTRUCTORS
*********************************************/
Animal::~Animal() {
std::cout << COPLIEN_COLOR "Animal destructor" RESET "\n";
return;
}
/*********************************************
* OPERATORS
*********************************************/
Animal & Animal::operator=( Animal const & rhs ) {
std::cout << COPLIEN_COLOR "Animal assignator" RESET "\n";
if ( this != &rhs )
{
type = rhs.getType();
}
return *this;
}
std::string Animal::getType() const {return type;}
/*********************************************
* PUBLIC MEMBER FUNCTIONS
*********************************************/
void Animal::makeSound() const {
std::cout << "*sound*\n";
}