// 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 C
{
   private:
      int v;
   public:
      C(int v) { this->v = v; };
      int GetV() { return v; };
      void SetV(int v) { this->v = v; };
};

void test1(C* o)
{
   cout << o << endl;
   o->SetV(1234);
   return;
}

void test2(C& o)
{
   cout << &o << endl;
   o.SetV(12345);
   return;
}

void test3(C o)
{
   cout << &o << endl;
   o.SetV(123456);
   return;
}

int main()
{
   C *o = new C(123);
   cout << o << endl;
   cout << o->GetV() << endl;
   test1(o);
   cout << o->GetV() << endl;
   test2(*o);
   cout << o->GetV() << endl;
   test3(*o);
   cout << o->GetV() << endl;
   return 0;
}
