public IVeggies[] CreateVeggies() { IVeggies[] veggies = new IVeggies[] { new Garlic(), new Onion(), new Mushroom(), new RedPepper() }; return(veggies); }
public IVeggies[] CreateVeggies() { IVeggies[] veggies = new IVeggies[] { new Eggplant(), new Spinach(), new Oregano(), new BlackOlives() }; return(veggies); }
static void Main(string[] args) { IPizzaIngredientFactory ingredientFactory = FactoryProvider.GetPizzaIngredientFactory("NY"); IDough dough = ingredientFactory.GetConcreteProduct <IDough>(); ISauce sauce = ingredientFactory.GetConcreteProduct <ISauce>(); ICheese cheese = ingredientFactory.GetConcreteProduct <ICheese>(); IVeggies veggies = ingredientFactory.GetConcreteProduct <IVeggies>(); IPepperoni pepperoni = ingredientFactory.GetConcreteProduct <IPepperoni>(); IClam clam = ingredientFactory.GetConcreteProduct <IClam>(); ingredientFactory.getStyle(); Console.WriteLine("Состав:"); dough.AboutMe(); sauce.AboutMe(); cheese.AboutMe(); veggies.AboutMe(); clam.AboutMe(); Console.WriteLine("\nЗаменим стиль\n"); ingredientFactory = FactoryProvider.GetPizzaIngredientFactory("Chicago"); dough = ingredientFactory.GetConcreteProduct <IDough>(); sauce = ingredientFactory.GetConcreteProduct <ISauce>(); cheese = ingredientFactory.GetConcreteProduct <ICheese>(); veggies = ingredientFactory.GetConcreteProduct <IVeggies>(); pepperoni = ingredientFactory.GetConcreteProduct <IPepperoni>(); clam = ingredientFactory.GetConcreteProduct <IClam>(); ingredientFactory.getStyle(); Console.WriteLine("Состав:"); dough.AboutMe(); sauce.AboutMe(); cheese.AboutMe(); veggies.AboutMe(); clam.AboutMe(); Console.ReadKey(); }
public IVeggies[] createVeggies(PizzaType t) { IVeggies[] veggies; switch (t) { case PizzaType.VEGGIE: veggies = new IVeggies[] { new Onion(), new GreenPepper(), new RoastedRedPepper(), new Mushroom(), new BlackOlive() }; break; case PizzaType.DELUXE: veggies = new IVeggies[] { new Onion(), new Mushroom(), new GreenPepper(), new BlackOlive() }; break; default: veggies = null; break; } return(veggies); }