Instance Class Members : Class Instance : Class C# Examples


C# Examples » Class » Class Instance »

 

Instance Class Members









    
using  System;

class  MyClass
{
      public  int  memberVariable;
}

class  MainClass
{
      static  void  Main()
      {
            MyClass  d1  =  new  MyClass();
            MyClass  d2  =  new  MyClass();
            d1.memberVariable  =  10;  
            d2.memberVariable  =  28;
            Console.WriteLine("d1  =  {0},  d2  =  {1}",  d1.memberVariable,  d2.memberVariable);
      }
}
    
   
  
   



Output

d1 = 10, d2 = 28


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Class Instance