Use base keyword to access field in the base class : base « Class « C# / CSharp Tutorial






using System;

class BaseClass                                      
{
   public string Field1 = "In the base class";
}

class DerivedClass : BaseClass                        
{
   new public string Field1 = "In the derived class";

   public void Display()
   {
      Console.WriteLine("{0}", Field1);              // Access the derived class.
      Console.WriteLine("{0}", base.Field1);         // Access the base class.
   }
}

class Program
{
   static void Main()
   {
      DerivedClass oc = new DerivedClass();
      oc.Display();
   }
}
In the derived class
In the base class








7.25.base
7.25.1.Using base to Access a Hidden Name
7.25.2.Use base keyword to access field in the base class
7.25.3.a subclass uses the keyword base to invoke a particular subclass constructor