Inheritance
Inheritance is the process through that one object could obtain the properties of another object. This is very important because it supports the concept of classification. Major information is made manageable by hierarchical classifications if you think about it. For instance, a Red Delicious apple is category of the classification apple that in turn is part of the fruit class that is under the larger class food. Without the use of categories, every object would have to define explicitly all of its features. Although, by the use of classifications, an object requires only define those qualities which make it unique inside its class. It is the inheritance mechanism which makes it possible for one object to be a specific object of a more common case. As you will see, inheritance is a very important aspect of object-oriented programming.
Inheritance permits new classes to be built from older and less specialized classes alter of being rewritten from scratch. The method of building new classes from the existing classes is known as inheritance.
Inheritance is a prime characteristic of Object Oriented Programming which can be starts as the process of creating new classes which is known as derived classes, from the existing classes. The derived class inherits all the capabilities of the base class and could add refinements and extensions of its own. A base class remains unchanged. This derivation of a new class from the existing class is represented in the provided in the figure.
The major benefits of the inheritance are:
- Reusability of the code
- Reliability of the code
- Enhancement of the base class