Inherited Implementation : Class hierarchy « Class « C# / CSharp Tutorial






using System;


interface Interface1 { 
     void PrintOut(string s); 
}

class BaseClass 
{
   public void PrintOut(string s)      
   {
      Console.WriteLine("Calling through: {0}", s);
   }
}

class Derived : BaseClass, Interface1     
{
}

class MainClass
{
   static void Main()
   {
      Derived d = new Derived();       
      d.PrintOut("object.");           
   }
}
Calling through: object.








7.20.Class hierarchy
7.20.1.A simple class hierarchy.
7.20.2.A multilevel hierarchy.
7.20.3.Demonstrate when constructors are called.
7.20.4.Simple Inheritance
7.20.5.Inherited Implementation