Code Smells

Code Smells / Object-Orientation Abusers / Refused Bequest

Refused Bequest code smell icon

Refused Bequest

A Refused Bequest smell occurs when a subclass removes or hides inherited functionality.

This is an indication that the class should not be a subclass of that parent class, since child classes should be adding or modifying functionality.

To fix this, determine whether the class should be inheriting from the parent class’ parent class, or whether the subclass should remain a subclass at all.

Left chevron Right chevron

Books about code smells

Learn to write better smelling code.

Refactoring: Improving the Design of Existing Code book cover

Refactoring: Improving the Design of Existing Code

Code smells: A Predictor of Remarkable Quality Improvement book cover

Code smells: A Predictor of Remarkable Quality Improvement

Clean Code: A Handbook of Agile Software Craftsmanship book cover

Clean Code: A Handbook of Agile Software Craftsmanship

I receive a commission on sales made from the above affiliate links.