Home / Questions / What is the main benefit of Inheritance?
Explanatory Question

What is the main benefit of Inheritance?

👁 15 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

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.