int main() { const Cat c; c.MakeSound(); const Dog d; d.MakeSound(); }
int main() { const Cat c; c.MakeSound(); const Dog d; d.MakeSound(); //Now use the same Animal pointer for different animals Animal * animal{new Cat}; animal->MakeSound(); delete animal; animal = new Dog; animal->MakeSound(); delete animal; }