Override abstract method : Abstract Class : Class C# Examples


C# Examples » Class » Abstract Class »

 

Override abstract method









    
using  System;

class  MainClass
{
    static  void  Main(string[]  args)
    {
        B  MyB  =  new  C();

        MyB.Display();
    }
}

abstract  class  A
{
    public  abstract  void  Display();
}
class  B:  A
{
    public  override  void  Display()
    {
        Console.WriteLine("Class  B's  Display  Method");
    }
}
class  C:  B
{
    public  override  void  Display()
    {
        Console.WriteLine("Class  C's  Display  Method");
    }
}
class  D:  C
{
    public  override  void  Display()
    {
        Console.WriteLine("Class  D's  Display  Method");
    }
}
    
   
  
   



Output

Class C's Display Method


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Abstract Class