Java - InheritanceClass 12 - Informatics Practices
Q1: What do you mean by the term 'inheritance'?
Answer: In OOPs, Inheritance is the process of creating new class (Derived Class or sub-classes) from an existing class (Base Class or Super class). A Sub-class inherits all the properties (data members) and behaviour (method members) of the parent class (Super-class).
The level of Inheritance may be extended i.e. A Sub-class may have their own sub-classes.
In Real-life most of the things exhibit Inheritance relationship.
Q2: What is the importance of 'inheriatnce'?
Answer: Inheritance is important for the following reasons:
① Modelling of Real-world
② Reusability of codes
③ Transitive nature of Inheritance