0
How to create a group? The apple issue.
example: We have 3 different apples 🍎 and 3 different cooks - slow, middle and fast cook all cooks should cut the apples at the same time we have the method cutApple how do I group all the apples? I want to say like: cut apples now maybe later cut peaches, than tomatoes? for all the objects I made constructors like Apple.greenApple = new Apple thank you for your help.
1 Respuesta
+ 2
You can use an abstract class and extend Apple, Peach and Tomato from it.
Three different cooks are simply three objects of class Cook with different cookingAbility (you could use an enum for that).