Inheritance |
|
Inheritance is the property of one class to inherit the properties of an another class. Major reason behind inheritance is reusability. The mechanism of deriving a new class from an old or existing class is called i nheritance (derivation). The old class is referred to as the base class and new class is called derived class or sub class. The derived class inherits some or all of the traits from the base class. A class can also inherit properties from more than one class, for more than one level. Types of inheritance
Deriving a Class The private derivation means that the derived class can access the public and the protected members of the base class privately. With privately derived class, the public and the protected members of the base class become private members of the derived class. Visibility of inherited members
Single level Inheritance
Multi level inheritance
|
||||||||||||||||||||
Discuss Inheritance in the forums.






