top | item 29534857

(no title)

BorisTheBrave | 4 years ago

In most languages Subset would be called a trait or interface, rather than general inheritance. You've picked an example with no fields or overriden methods, so it's impossible for it to demonstrate the shortcomings of inheritance.

discuss

order

ridiculous_fish|4 years ago

What is the practical difference between inheritance, and a trait or interface with a default implementation? It seems like both risk the addAll() bug.

rackjack|4 years ago

Multiple inheritance is basically strictly more powerful than either traits or interfaces with default implementations.

I don't think traits or interfaces with default implementations prevent the bug, as I can imagine a Rust implementation that would do something similar.