Virtual Inheritance should be default

Pages: 123
My point is that inheritance should never be used by "laziness".

Avoiding code duplication by using inheritance is laziness I think because it is not flexible and composition is more suited for that.

I have this opinion because when I discovered OOP I used inheritance typically to put common behaviour in a base class with a big hierarchy, as all OOP beginners do. But at some point I realized how unflexible this architecture was and the code became more and more terrible and unmaintenable.

That's why MI is rarely useful. In a ideal world, only leaf class of a hierarchy should contain code. (but this is utopy, i admit i am lazy sometimes and everyone is:)

Next, we need a way for an overrideable method to declare that overriding methods must, at some point in the overridden method, call the method being overridden.

I think we will never see that in the standard for the same reason. But as a compiler extension handled by major compilers like pragma once, why not.
Topic archived. No new replies allowed.
Pages: 123