2 ms·
I would argue that if you have a "Item" class then it is the set of all concretions/specializations. By creating a tool class you haven't extended the set, you
by imtringued 5y ago
I would argue that if you have a "Item" class then it is the set of all concretions/specializations.
By creating a tool class you haven't extended the set, you've instantiated a subset of the set of items that contains the items that are tools but nothing else. It's obvious why it is so difficult to represent a tool that is also e.g. a consumable item. The set of items that are both tools and consumables is a superset of the set of tools and set of items. You can't represent it through a second layer of inheritance because it only lets you create a subset of the items that are tools. You obviously have to use multiple inheritance for something like this because it will let you form the set of items that are both tools and consumables. Of course, multiple inheritance is very messy so you should try to avoid it.