✏️ Explanatory Question

What is the main benefit of Inheritance?

👁 19 Views
📘 Detailed Answer
🟢 Easy
💡

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.