Inheritance from both class and interface : Interface hierarchy : Class C# Examples


C# Examples » Class » Interface hierarchy »

 

Inheritance from both class and interface









    
using  System;

public  class  Control  {
        public  void  Serialize()  {
                Console.WriteLine("Control.Serialize  called");
        }
}

public  interface  IDataBound  {
        void  Serialize();
}

public  class  EditBox  :  Control,  IDataBound  {
}

class  InterfaceInh2App  {
        public  static  void  Main()  {
                EditBox  edit  =  new  EditBox();

                IDataBound  bound  =  edit  as  IDataBound;
                if  (bound  !=  null)  {
                        Console.WriteLine("IDataBound  is  supported...");
                        bound.Serialize();
                }  else  {
                        Console.WriteLine("IDataBound  is  NOT  supported...");
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Interface hierarchy