Explanatory Question
What is the main benefit of Inheritance?
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.
Inheritance allows a class (child/subclass) to acquire the properties and methods of another class (parent/superclass).
This provides:
Code reusability
Faster development
Avoiding duplication
Easy maintenance
Ability to create hierarchical relationships
Example:
A Car class and a SportsCar class. SportsCar inherits features from Car but can add its own features.
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.