|
|
|
|
|
by repsilat
2949 days ago
|
|
Mm. For me there are only a few reasons to use inheritance: - Common operations between classes, operating on common data, but requiring an external API (so composition is a pain because you would have to proxy those actions to the member.) - Restricting/specifying the types of objects you can store in a container if you are programming in a language/codebase that cares about that (incl. the C++ "definitely has the vtable I want".) And maybe that's it? I guess all the taxonomy talk might be useful in the first hour of learning about inheritance, but after that I think the analogy should give way to more concrete "what are the code and data doing?" angle. |
|