// 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 X
{
public:
    X() { cout << "X ctor" << endl; }
    virtual ~X() { cout << "X dtor" << endl; }
};

class Y
{
public:
    Y() { cout << "Y ctor" << endl; }
    virtual ~Y() { cout << "Y dtor" << endl; }
};

class Z
{
public:
    Z() { cout << "Z ctor" << endl; }
    virtual ~Z() { cout << "Z dtor" << endl; }
};

class W
{
public:
    W() { cout << "W ctor" << endl; }
    virtual ~W() { cout << "W dtor" << endl; }
};

int main()
{
    X *x = new X();
    delete x;
    Y *y = new Y[3];
    delete[] y;
    Z z;
    W w[3];
    return 0;
}
