I have class Fruit with data and logic.
Now I need a lot of different fruits, which only differ in: name, bitmap, and some other data.
Is there any sense in making a new subclass for each fruit? They have all “is a” relationship with fruit. But they don’t add new behaviour or fields.
Maybe it’s better just to give the fuit a “type” field, instead of subclassing it? Is anything wrong with that?
What kind of types of fruit are you trying to distinguish? If its just a typing diffidence I tend to use an enum value, from an enum list defined in the base class (in this case fruit) and then passed or initialized on the inheriting class’s constructor.
eg
you can just define specific values in constructor for name etc