Mega Code Archive

 
Categories / Visual C++ .NET / Class
 

Reference and Indirection

#include "stdafx.h" using namespace System; ref class RefClass  { public:     int X;     RefClass(int x)     {         X = x;     } }; void main() {     RefClass rc(10);     RefClass ^o;          o = %rc;                     Console::WriteLine(o->X);      rc.X = 20;                     Console::WriteLine(o->X);      int %i = rc.X;                 i = 30;                        Console::WriteLine(o->X);  }