Which object-oriented concept allows a class to acquire properties and methods of another class?
15 views
- Association
- Composition
- Inheritance (Correct Answer)
- Aggregation
Explanation
Inheritance allows a class (subclass) to inherit attributes and methods from another class (superclass), enabling reusability and hierarchical relationships. Composition/aggregation define part-whole relationships, and association represents relationships between objects.