Static Method demo : static method « Class « Visual C++ .NET






Static Method demo

 

#include "stdafx.h"
using namespace System;

ref class MyClass
{
private:
    static int x = 42;
public:
   static int get_x()
   {
      return x;
   }
};

void main()
{
    Console::WriteLine ( MyClass::get_x() );
} 

   
  








Related examples in the same category