Inheritance In C#
What is Inheritance?
               It’s a process of getting the members of one class from another class by using a relationship between parent and child concept. Class can have members, property or methods, same can be consumed in any of the class by inheriting them from the required class. This operation can be done without inheriting the parent class, but this will violate the OOPS advantage of re- usability because we must duplicate the code of parent to the required class. These are mainly derived from the Base library – “System” Class.

Example, Skelton
public Demo
       {
             Public void Display()
      {
    
      }             
     
}
public Demo2 : Demo
       {
             Public void DisplayfromDemo2()
      {
             Display(); // Inherited from Parent Class
      }             
     
}
Example, Real Time Example:


                                                                                                                                   





Comments

Post a Comment

Popular posts from this blog