#include #include using namespace std; class animal { public: virtual void talk() {}; virtual void alternative_talk() {}; }; class cat : public animal { public: void talk() override { cout << "meow\n"; } void alternative_talk() { cout << "whirp\n"; } }; class goat : public animal { public: void talk() { cout << "mah\n"; } void alternative_talk() { cout << "blah\n"; } }; int main(){ cat c; goat g; vector zoo; zoo.push_back(&c); zoo.push_back(&g); for(auto a : zoo) a->talk(); return 0; }