ReusabilityReusability means the reuse of properties of the base class in the derived classes. Reusability permits the reuse of members of the previous class. We can add extra features in the existing class. This is possible by creating a new class from the existing class. The new class will have the features of both the old and the derived new class. In Figure (Inheritances), the base class is reused. Reusability is achieved using inheritance. Inheritance and reusability are not different from each other. The outcome of inheritance is reusability.
In this chapter, we will deal with implementation of the mechanism of inheritance and understand its features by illustrating several examples. One can find the inheritance property in several languages, but inheritance property in C++ is slightly different. C++ enables an inheritance of all the properties of the previous class, and there is a flexibility to add new members in the derived class, which are not available in the parent class.
The base class is also called superclass, parent, or ancestor, and the derived class is called subclass, child, or descendent. It is also possible to derive a class from a previously derived class. A class can be derived from more than one class.
The procedure of creating a new class from one or more existing classes is termed inheritance.