Mac's avatar

MacReiben Web Zone

Christian Finel, software craftsman, DDs stuffs addict - @macreiben.

How to fail inheritance

Inheritance abuses bores me. I’m sorry to tell this, but IT teaching is often responsible.

The course usually say something like this:

When behaviour is used in several classes, then create a root class and put your code in there in a protected method. So all the children classes can reuse the behaviour.

So inheritance is solving the reusability problem.

I learnt to code this way, with a bunch of animals as examples.

Read more →