#include "Animal.hpp" #include "Dog.hpp" #include "Cat.hpp" #include "WrongAnimal.hpp" #include "WrongCat.hpp" #include #include int main() { const Animal* meta = new Animal(); const Animal* j = new Dog(); const Animal* i = new Cat(); std::cout << j->getType() << " " << std::endl; std::cout << i->getType() << " " << std::endl; i->makeSound(); //will output the cat sound! j->makeSound(); meta->makeSound(); { std::cout << std::endl; const Cat* i = new Cat(); const Animal* j = new Cat(); std::cout << j->getType() << " " << std::endl; std::cout << i->getType() << " " << std::endl; i->makeSound(); //will output the cat sound! j->makeSound(); } { std::cout << std::endl; const WrongAnimal* i = new WrongAnimal(); const WrongAnimal* j = new WrongCat(); std::cout << i->getType() << " " << std::endl; std::cout << j->getType() << " " << std::endl; i->makeSound(); //will output the cat sound! j->makeSound(); } { std::cout << std::endl; const WrongCat* i = new WrongCat(); const WrongAnimal* j = new WrongCat(); std::cout << j->getType() << " " << std::endl; std::cout << i->getType() << " " << std::endl; i->makeSound(); //will output the cat sound! j->makeSound(); } return 0; }