// 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>

using namespace std;

class P
{
    protected:
        int myvalue;
    public:
        P() { myvalue = 0; }
};

class C1 : virtual public P
{
    public:
        void IncVal() { this->myvalue++; }
        int GetVal() { return this->myvalue; }
};

class C2 : virtual public P
{
    public:
        void IncValue() { this->myvalue++; }
        int GetValue() { return this->myvalue; }
};

class GC : public C1, public C2
{
};

int main()
{
    GC *o = new GC();
    o->IncVal();
    o->IncValue();
    cout << o->GetVal() << " " << o->GetValue() << endl;
    return 0;
}
