/// <summary> /// Low level concrete pizza factory method. /// </summary> /// <param name="type">Type of pizza</param> /// <returns>Concrete Chicago Style pizza</returns> public override Pizza CreatePizza(string type) { Pizza pizza = null; switch (type.ToLower()) { case "cheese": pizza = new ChicagoCheesePizza(); break; case "pepperoni": pizza = new ChicagoPepperoniPizza(); break; case "clam": pizza = new ChicagoClamPizza(); break; case "veggie": pizza = new ChicagoVeggiePizza(); break; default: break; } return(pizza); }
public override Pizza CreatePizza(PizzaTypes pizzaType) { Pizza pizza = null; switch (pizzaType) { case PizzaTypes.Cheese: pizza = new ChicagoCheesePizza(); break; case PizzaTypes.Greek: pizza = new ChicagoGreekPizza(); break; case PizzaTypes.Papperoni: pizza = new ChicagoPapperoniPizza(); break; default: throw new ArgumentException("Wrong PizzaTypes"); } if (pizza != null) { return(pizza); } else { throw new NullReferenceException("Pizza is null"); } }
protected override Pizza CreatePizza(PizzaType pizzaType) { Pizza pizza = null; var pizzaIngredientFactory = new ChicagoPizzaIngredientFactory(); switch (pizzaType) { case PizzaType.Cheese: pizza = new ChicagoCheesePizza(pizzaIngredientFactory); break; case PizzaType.Pepperoni: pizza = new ChicagoPepperoniPizza(pizzaIngredientFactory); break; case PizzaType.Clam: pizza = new ChicagoClamPizza(pizzaIngredientFactory); break; case PizzaType.Veggie: pizza = new ChicagoVeggiePizza(pizzaIngredientFactory); break; } return(pizza); }
public override Pizza CreatePizza(string pizzaType) { Pizza pizza = null; if (pizzaType == "cheese") { pizza = new ChicagoCheesePizza(); } return(pizza); }
public override Pizza CreatePizza(string type) { Pizza pizza = null; if (type.Equals("cheese")) pizza = new ChicagoCheesePizza(); else if (type.Equals("greek")) pizza = new GreekPizza(); else if (type.Equals("pepperoni")) pizza = new PepperoniPizza(); return pizza; }
protected override Pizza CreatePizza(string type) { Pizza pizza = null; if (type.Equals("cheese")) { pizza = new ChicagoCheesePizza(); } return(pizza); }
protected override Pizza CreatePizza(string type) { Pizza pizza = null; switch (type) { case "cheese": pizza = new ChicagoCheesePizza(); break; case "pepperoni": pizza = new ChicagoPepperoniPizza(); break; case "clam": pizza = new ChicagoClamPizza(); break; } return(pizza); }