Virtual Properties : Virtual Properties : Class C# Examples


C# Examples » Class » Virtual Properties »

 

Virtual Properties









    
using  System;

public  abstract  class  Employee
{
        public  abstract  string  Name
        {
                get;
        }
}
class  Engineer:  Employee
{
        string  name  =  "Engineer";
        
        public  override  string  Name
        {
                get
                {
                        return(name);
                }
        }
}
class  MainClass
{
        public  static  void  Main()
        {
                Employee  d  =  new  Engineer();
                Console.WriteLine("Name:  {0}",  d.Name);
        }
}
    
   
  
   



Output

Name: Engineer


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Virtual Properties