fix: wrongcat

This commit is contained in:
Camille Chauvet 2023-08-09 15:27:58 +00:00
parent 037daaf8e9
commit 1341068efe
3 changed files with 11 additions and 0 deletions

View File

@ -22,3 +22,8 @@ WrongCat::WrongCat(const WrongCat& src): WrongAnimal()
{ {
*this = src; *this = src;
} }
void WrongCat::makeSound() const
{
std::cout << "Meow Meow !" << std::endl;
}

View File

@ -11,4 +11,6 @@ class WrongCat : public WrongAnimal
WrongCat &operator=(const WrongCat& src); WrongCat &operator=(const WrongCat& src);
WrongCat(); WrongCat();
~WrongCat(); ~WrongCat();
void makeSound() const;
}; };

View File

@ -2,6 +2,7 @@
#include "Cat.hpp" #include "Cat.hpp"
#include "Dog.hpp" #include "Dog.hpp"
#include "WrongAnimal.hpp"
#include "WrongCat.hpp" #include "WrongCat.hpp"
int main() int main()
@ -12,5 +13,8 @@ int main()
delete j; delete j;
const Animal* i = new Cat(); const Animal* i = new Cat();
delete i; delete i;
const WrongAnimal* k = new WrongCat();
k->makeSound();
delete k;
return 0; return 0;
} }