Inheritance only with abstract classes

Here’s a Sunday thought: inheritance should only be done for abstract classes. Anything else you think you need from inheritance should probably be done with composition.

Take the canonical human example. We’re not only humans, right? We’re actually a specific type of human: male, female (or any other gender, irrelevant for the example). We have common behaviour but then specific features based on the base gender.

Being a human is an abstract concept. More specific than a mammal, but more abstract than any of its subtypes.

Have a nice weekend! 👋