# include "Animal.hpp" # include "WrongAnimal.hpp" # include "Dog.hpp" # include "Cat.hpp" # include "WrongCat.hpp" int main() { std::cout << "========== TEST 1: Basic Animal ==========" << std::endl; { std::cout << "\n========== Animal ==========" << std::endl; const Animal* meta = new Animal(); std::cout << meta->getType() << " " << std::endl; meta->makeSound(); delete meta; std::cout << "\n========== Dog ==========" << std::endl; const Animal* j = new Dog(); std::cout << j->getType() << " " << std::endl; j->makeSound(); delete j; std::cout << "\n========== Cat ==========" << std::endl; const Animal* i = new Cat(); std::cout << i->getType() << " " << std::endl; j->makeSound(); delete i; } std::cout << "\n========== TEST 2: Wrong Animal (No Virtual) ==========" << std::endl; { std::cout << "\n========== WrongAnimal ==========" << std::endl; const WrongAnimal* k = new WrongAnimal(); std::cout << "WrongAnimal type: " << k->getType() << std::endl; k->makeSound(); // WrongAnimal sound delete k; std::cout << "\n========== WrongCat ==========" << std::endl; const WrongAnimal* l = new WrongCat(); std::cout << "WrongCat type: " << l->getType() << std::endl; l->makeSound(); // WrongAnimal sound aussi (pas de polymorphisme!) delete l; } return (0); }