Workaround for traditional inheritance features in object-oriented languages

Hello again. Thanks again for the links. So now I’ve mostly read through them. The message that I get is that composition and inheritance both have value and one cannot replace the other. The last article you listed makes that point explicitly:

The Wikipedia page makes roughly the same point. Wikipedia gives both benefits and drawbacks to composition, and the main drawback is having to re-implement methods. They gives an “employee” problem, similar to the one from @juliohm, as an example of something that works better with inheritance.

Anyway, the articles were interesting and they convinced me that both techniques have a valuable role to play ideally neither one would be neglected.

1 Like