// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <vector>

using namespace std;

class P
{
    protected:
        int vp;
    public:
        P(int vp) { this->vp = vp; }
        virtual void print() { cout << "P: " << vp << endl; }
};

class C : public P
{
    protected:
        int vc;
    public:
        C(int vp, int vc) : P(vp) { this->vc = vc; }
        virtual void print() { cout << "C: " << vp << " " << vc << endl; }
};

int main()
{
    P op(123);
    op.print();
    C oc(456, 789);
    oc.print();
    vector<P> v;
    v.push_back(op);
    v.push_back(oc);
    v[0].print();
    v[1].print();
    return 0;
}
