Its a simple question really.
class salad
class chef_salad extends salad
class ceasar_salad extends salad
So I have a variable type and I want to create the appropriate object based on type.
Apparently I can do
if(type.equals("chef"){ salad s = new chef_salad(); }
I suppose I can even make that a static method that returns a salad object, but is this really the best approach or there is a better way to do it through constructors?
ps. fictional example