2 ms·
There's nothing wrong with objects. Hierarchies of objects, though, ran into the "is-a" problem. Multiple inheritance has even worse problems, especially around
by Animats 7y ago
There's nothing wrong with objects. Hierarchies of objects, though, ran into the "is-a" problem. Multiple inheritance has even worse problems, especially around order of initialization.
Now that people are mostly over inheritance for the sake of inheritance, it's not so bad. Often, you want to have one class be a member of another, rather than a child of it.
This brings up a common problem. If A is a member of B, B sometimes wants a back-reference to A. This is hard to set up in some languages. It should be made easy, because it removes much of the need for inheritance. For Rust, especially, it's a special case of Rust's back-pointer problem, the one that makes doubly linked lists and trees with backpointers hard. Not having this encourages the creation of structures with too many data elements.