// source код брав з гугл диску static void Main(string[] args) { Waiter waiter = new Waiter(); PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder(); PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder(); PizzaBuilder margaritaBuilder = new MargaritaPizzaBuilder(); Console.WriteLine("\ncustomer orders hawaiian\n"); waiter.SetPizzaBuilder(hawaiianPizzaBuilder); waiter.ConstructPizza(); Pizza pizza = waiter.GetPizza(); pizza.Info(); Console.WriteLine("\ncustomer orders spicy\n"); waiter.SetPizzaBuilder(spicyPizzaBuilder); waiter.ConstructPizza(); pizza = waiter.GetPizza(); pizza.Info(); Console.WriteLine("\ncustomer orders margarita\n"); waiter.SetPizzaBuilder(margaritaBuilder); waiter.ConstructPizza(); pizza = waiter.GetPizza(); pizza.Info(); Console.ReadKey(); }
public static void Main(String[] args) { Waiter waiter = new Waiter(); PizzaBuilder hawaiianPizzaBuilder = new HawaiianPizzaBuilder(); waiter.SetPizzaBuilder(hawaiianPizzaBuilder); waiter.ConstructPizza(); Pizza pizza1 = waiter.GetPizza(); pizza1.Info(); PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder(); waiter.SetPizzaBuilder(spicyPizzaBuilder); waiter.ConstructPizza(); Pizza pizza2 = waiter.GetPizza(); pizza2.Info(); PizzaBuilder margaritaPizzaBuilder = new MargaritaPizzaBuilder(); waiter.SetPizzaBuilder(margaritaPizzaBuilder); waiter.ConstructPizza(); Pizza pizza3 = waiter.GetPizza(); pizza3.Info(); Console.ReadKey(); }
static void Main(string[] args) { var firstBuilder = new MargaritaPizzaBuilder(); var secondBuilder = new CustomPizzaBuilder(); var shop = new Shop(); shop.SetPizzaBuilder(firstBuilder); shop.ConstructNewPizza(); var pizza1 = shop.Construct(); shop.SetPizzaBuilder(secondBuilder); shop.ConstructNewPizza(); var pizza2 = shop.Construct(); Console.WriteLine(pizza1.ToString()); Console.WriteLine(pizza2.ToString()); Console.ReadKey(); }