d04 ex02 ok, presque rien a changer ou je me trompe ?
This commit is contained in:
52
d04/ex01/srcs/Animal.cpp
Normal file
52
d04/ex01/srcs/Animal.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user