Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:
Inheritance is a core concept in object-oriented programming (OOP). The question probes a common misconception: that introducing a derived (sub)class forces sweeping or “fundamental” changes to an existing base class. Sound OOP design emphasizes substitutability, encapsulation, and extensibility without retrofitting the base.
Given Data / Assumptions:
Concept / Approach:
Inheritance allows a derived class to reuse and extend behavior via the base’s public/protected interface. Because encapsulation hides implementation details, adding a subclass typically does not require modifying the base. If changes are needed, they are usually additive (e.g., adding virtual hooks or protected extension points) rather than fundamental. The Liskov Substitution Principle encourages designing bases so that derived types can slot in without base changes.
Step-by-Step Solution:
Verification / Alternative check:
Many frameworks (e.g., GUI toolkits) let you derive and override behavior without editing the base classes. If base redesign is routinely required, the abstraction is likely leaky and needs refactoring, not because inheritance intrinsically demands it.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing “adding virtual” with “fundamental change”; conflating refactoring for better extensibility with a strict requirement; exposing base internals that force downstream edits.
Final Answer:
Incorrect
Discussion & Comments