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

using namespace std;

class X
{
private:
    int v;
public:
    X() : X(0) { }
    X(int v) { cout << "ctor " << v << endl; this->v = v; }
    virtual ~X() { cout << "dtor" << endl; }
    int GetV() { return v; }
};

int main()
{
    X *o = new X(123);
    cout << "v = " << o->GetV() << endl;
    delete o;
    X *a = new X[2];
    cout << "v = " << a[0].GetV() << endl;
    cout << "v = " << a[1].GetV() << endl;
    delete[] a;
    return 0;
}
