Problem Statement
Why should you avoid improper inheritance and prefer composition in some cases? Provide reasons.
Explanation
While inheritance offers reuse, it can also introduce tight coupling, fragility when base classes change, and violates encapsulation if subclass depends heavily on parent internals. Composition (‘has-a’ relationship) is often more flexible: you can change behaviour at run time by delegating to different components and avoid deep inheritance hierarchies. In interviews highlighting “favor composition over inheritance” demonstrates sound design sense.