Back to Catalog
Code Smells
Object-Orientation Abusers
Refused Bequest
Subclasses that don't use methods or properties inherited from parent classes.
Intent & Description
'
🎯 Intent
Identify when subclasses reject or don’t use inherited behavior, indicating inappropriate inheritance.
📋 Context
A subclass inherits methods or properties from its parent but doesn’t use them or throws exceptions when called.
💡 Solution
Consider composition over inheritance, or refactor the inheritance hierarchy.'
Real-world Use Case
Use when subclasses consistently ignore or override inherited behavior.
Source
📌 TL;DR
When subclasses reject inheritance, composition is likely a better choice.