Interface Inheritance Demo : Interface hierarchy : Class C# Examples


C# Examples » Class » Interface hierarchy »

 

Interface Inheritance Demo









    
using  System;

interface  ITest  {
        void  Foo();
}

class  Base  :  ITest  {
        public  void  Foo()  {
                Console.WriteLine("Base.Foo  (ITest  implementation)");
        }
}

class  MyDerived  :  Base  {
        public  new  void  Foo()  {
                Console.WriteLine("MyDerived.Foo");
        }
}

public  class  InterfaceInh3App  {
        public  static  void  Main()  {
                MyDerived  myDerived  =  new  MyDerived();
                Console.WriteLine();

                myDerived.Foo();
                Console.WriteLine();

                ((ITest)myDerived).Foo();
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Interface hierarchy