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

using namespace std;

class X
{
    private:
        int v;
    public:
        X(int v) { this->v = v; cout << "construct " << v << endl; }
        virtual ~X() { cout << "destruct " << v << endl; }     
        void hi() { cout << "hi " << v << endl; }
};

int main()
{
    X o1(1);
    X *o2 = new X(2);
    unique_ptr<X> o3(new X(3));
    o1.hi();
    o2->hi();
    o3->hi();
    delete o2;
    return 0;
}
