So, for example, I have classes of vegetables for a farm.
TVegetable = class
TCarrot = class(TVegetable)
TTomato = class(TVegetable)
I need two different classes of each vegetable, one for supermarkets and another for factories.
TCarrotSupermarket = class(TCarrot)
TCarrotFactory = class(TCarrot)
These classes are identical except the code for one method:
procedure Utilization;
TCarrotSupermarket.Utilization works with supermarkets, TCarrotFactory.Utilization works with factories.
One identical code for Utilization I need for
TCarrotSupermarket.Utilization, TTomatoSupermarket.Utilization, TPotatoSupermarket.Utilization, and another code for
TCarrotFactory.Utilization, TTomatoFactory.Utilization, TPotatoFactory.Utilization.
What is the best way to write code for Utilization only twice (for supermarkets and factories) and use it in a proper classes?