diff --git a/ex00/Animal/Animal.cpp b/ex00/Animal/Animal.cpp index bcd899b..82f859e 100644 --- a/ex00/Animal/Animal.cpp +++ b/ex00/Animal/Animal.cpp @@ -22,4 +22,21 @@ Animal::~Animal() std::cout << "Animal has been destroyed" << std::endl; } +Animal::Animal(const Animal &other) +{ + std::cout << "Animal copied" << std::endl; + *this = other; +} +Animal& Animal::operator=(const Animal &other) +{ + std::cout << "Animal copy assignment called" << std::endl; + if (this != &other) + this->type = other.type; + return (*this); +} + +void Animal::makeSound() const +{ + std::cout << "Animal weird sounds..." << std::endl; +} diff --git a/ex00/Animal/Animal.hpp b/ex00/Animal/Animal.hpp index d6b9d04..0432ea2 100644 --- a/ex00/Animal/Animal.hpp +++ b/ex00/Animal/Animal.hpp @@ -22,7 +22,11 @@ class Animal std::string type; public: Animal(); - ~Animal(); + virtual ~Animal(); + Animal(const Animal &other); + Animal& operator=(const Animal &other); + + virtual void makeSound() const; }; #endif