#include "stdafx.h" using namespace System; ref class MyClass { literal String^ name = "Bob"; public: MyClass() { Console::WriteLine(name); } void Print() { Console::WriteLine(name); } }; int main() { MyClass^ c = gcnew MyClass(); c->Print(); }