|
|
|
|
|
by echelon
805 days ago
|
|
There is no benefit to the "tree of life" single inheritance [1]. What you want to reach for to achieve compositional behavior or polymorphism are type classes, traits, and interfaces. They attach methods to data without the silly "Cat is an Animal, Dog is an Animal" cladistic design buffoonery. There's nothing wrong with OO, except for inheritance-based OO. [1] Don't get me started on multiple inheritance. Instead of solving problems, they invented them. |
|
Now, A human can create a child, but only if the parent object was a "Human." Am I thinking about this in the wrong way?