Mega Code Archive

 
Categories / Visual C++ .NET / Class
 

Ref type

#include "stdafx.h" using namespace System; ref class RefType {    String^ classname;    public:    RefType()    {       classname = gcnew String("RefType");    }    String^ GetMessage()    {        return String::Format("I am a " + classname);    } }; int main() {    RefType^ r = gcnew RefType();    Console::WriteLine(r->GetMessage()); }