PrintValue() Added to the BaseClass Class : Override : Class C# Examples


C# Examples » Class » Override »

 

PrintValue() Added to the BaseClass Class









    
using  System;
      
public  class  BaseClass
{
        protected  int  Value;
      
        public  BaseClass()
        {
                Value  =  123;
        }
      
        public  virtual  void  PrintValue()
        {
                Console.WriteLine("Value:  "  +  Value);
        }
}
      
public  class  DerivedClass  :  BaseClass
{
        public  void  PrintValue()
        {
                Console.WriteLine("Value  =  "  +  Value);
        }
}
      
class  MainClass
{
        public  static  void  Main()
        {
                DerivedClass  DerivedClassObject  =  new  DerivedClass();
      
                DerivedClassObject.PrintValue();
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Override