d04 ex02 ok, presque rien a changer ou je me trompe ?

This commit is contained in:
hugogogo
2022-02-26 22:12:55 +01:00
parent ed2bbc7fd2
commit c056db80b7
27 changed files with 597 additions and 68 deletions

42
d04/ex02/srcs/Animal.cpp Normal file
View File

@@ -0,0 +1,42 @@
#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;}