public override void prepare() { Console.WriteLine("Preparing" + name); dough = ingredientFactory.createDough(); sauce = ingredientFactory.createSauce(); clam = ingredientFactory.createClam(); }
public override void Prepare() { Console.WriteLine("准备:" + name); dough = _pizzaIngredientFactory.createDough(); sauce = _pizzaIngredientFactory.createSauce(); cheese = _pizzaIngredientFactory.createCheese(); clam = _pizzaIngredientFactory.createClam();//纽约工厂就会使用新鲜的蛤蜊,芝加哥工厂就会用冷冻的蛤蜊。 }