literal string initializer : literal « Class « Visual C++ .NET






literal string initializer

 


#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();
}

   
  








Related examples in the same category

1.static vs literal