Instance Class Members : Class Instance « Class « C# / CSharp Tutorial






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);
   }
}
d1 = 10, d2 = 28








7.2.Class Instance
7.2.1.Invoke a method in a class
7.2.2.Instance Class Members
7.2.3.Try to change static value in different instance
7.2.4.public member method
7.2.5.Creating an array of objects.
7.2.6.Call GetType and ToString on object instance