- It’s a process of acquiring the features (data members and member methods) of one class into another class.
- Inheritance process is also known as Extendibility or Reusability or Derivation or Sub-classing.
- Whichever class is giving its features to another class is known as Base Class or Parent Class or Super Class.
- Whichever class is acquiring the features from its base class is known as Derived class or Child Class or Sub Class.
- It is strongly recommended to create an object of bottom most Derived Class by which we can access the features of derived class as well as the features of its base class.
- Application Development time is very less.
- Repetition/Redundancy of the codes will get reduced. Hence, Occupation of memory space will be reduced.
- Investment cost towards project will be reduced.
- The performance of overall project will be improved.
TYPES OF INHERITANCE:
- SINGLE INHERITANCE: In this, there exists one Base Class and One Derived Class.
- MULTILEVEL INHERITANCE: In this, there exists one Base Class, one derived class and n # Intermediate Base Classes.
- Intermediate Base Class is one which acts as a derived class in one context and as a Base Class is some other context.
- MULTIPLE INHERITANCE: Java doesn’t support multiple Inheritances to the classes directly but it supports indirectly through the Interface. In this, there exists n # base classes and one derived class.
- HIERARCHICAL INHERITANCE: In this, there exists one base class and n # derived class.
- HYBRID INHERITANCE: It is a combination of two valid Inheritances.