// 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
{
public:
    void virtual foo(int v = 123) { cout << v << endl; }
};

class C : public P
{
public:
    void virtual foo(int v = 456) { P::foo(v); }
    void virtual bar() { cout << "Hi" << endl; }
};

int main()
{
    // old code
    P *o1 = new C();
    o1->foo();
    // new code
    C *o2 = new C();
    o2->bar();
    o2->foo();
    //
    return 0;
}
