protected override Pizza CreatePizza(string item) { IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory(); return(item switch { "cheese" => new CheesePizza("New York Style Cheese Pizza", ingredientFactory), "veggie" => new VeggiePizza("New York Style Veggie Pizza", ingredientFactory), "clam" => new ClamPizza("New York Style Clam Pizza", ingredientFactory), "pepperoni" => new PepperoniPizza("New York Style Pepperoni Pizza", ingredientFactory), _ => null });
protected override Pizza CreatePizza(string type) { Pizza pizza = null; IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory(); if (type.Equals("cheese")) { pizza = new CheesePizza(ingredientFactory); pizza.name = "Chicago Style Cheese Pizza"; } else { pizza = new PepperoniClamPizza(ingredientFactory); pizza.name = "Chicago Style Pepperoni Clam Pizza"; } return(pizza); }