#include <iostream>
#include <vector>
using namespace std;

class Shape {
    protected:
        Shape() {} // Having a protected constructor only allows you to
                   // call it from the same or derived class
    public:
        virtual void func()=0;
};

class Circle : public Shape {
    public:
        Circle() {  }
        void func() { cout << "Hello from a Circle object" << endl; }
};

class Square : public Shape {
    public:
        Square() {  }
        void func() { cout << "Hello from a Square object" << endl; }
};

int main() {
 
    std::vector<Shape*> shapes;
    Circle c;
    Square s;
    shapes.push_back(&c); // Store the address of the object
    shapes.push_back(&s); // Store the address of the object
    
    // A call through a pointer to a virtul polymorphic class
    // will make sure to call the appropriate function
    Shape ea;
    shapes[0]->func(); // Hello from a circle object
    shapes[1]->func(); // Hello from a square object
    

}