d04 ex01 en grande partie fait mais segfault qqpart
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
#include "Cat.hpp"
|
||||
|
||||
#define COPLIEN_COLOR B_CYAN
|
||||
|
||||
/*********************************************
|
||||
* CONSTRUCTORS
|
||||
*********************************************/
|
||||
|
||||
Cat::Cat() {
|
||||
Cat::Cat( Brain * brain ) {
|
||||
std::cout << COPLIEN_COLOR "Cat constructor" RESET "\n";
|
||||
type = "cat";
|
||||
_brain = brain;
|
||||
return;
|
||||
}
|
||||
|
||||
Cat::Cat( Cat const & src ) {
|
||||
std::cout << COPLIEN_COLOR "Cat copy constructor" RESET "\n";
|
||||
*this = src;
|
||||
return;
|
||||
}
|
||||
@@ -19,6 +24,7 @@ Cat::Cat( Cat const & src ) {
|
||||
*********************************************/
|
||||
|
||||
Cat::~Cat() {
|
||||
std::cout << COPLIEN_COLOR "Cat destructor" RESET "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -27,8 +33,9 @@ Cat::~Cat() {
|
||||
*********************************************/
|
||||
|
||||
Cat & Cat::operator=( Cat const & rhs ) {
|
||||
std::cout << COPLIEN_COLOR "Cat assignator" RESET "\n";
|
||||
Animal::operator=(rhs);
|
||||
|
||||
*_brain = *rhs._brain;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -39,4 +46,9 @@ Cat & Cat::operator=( Cat const & rhs ) {
|
||||
void Cat::makeSound() const {
|
||||
std::cout << "*miaow*\n";
|
||||
}
|
||||
|
||||
void Cat::printBrain() const {
|
||||
_brain->printIdeas();
|
||||
}
|
||||
void Cat::printBrain(int pos) const {
|
||||
_brain->printIdea(pos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user