示例#1
0
            public static void Main(String[] args)
            {
                Waiter       waiter = new Waiter();
                PizzaBuilder hawaiianPizzaBuilder  = new HawaiianPizzaBuilder();
                PizzaBuilder spicyPizzaBuilder     = new SpicyPizzaBuilder();
                PizzaBuilder margaritaPizzaBuilder = new MargatitaPizzaBuilder();

                waiter.SetPizzaBuilder(hawaiianPizzaBuilder);
                waiter.ConstructPizza();
                Pizza pizza = waiter.GetPizza();

                pizza.Info();

                waiter.SetPizzaBuilder(spicyPizzaBuilder);
                waiter.ConstructPizza();
                pizza = waiter.GetPizza();
                pizza.Info();

                waiter.SetPizzaBuilder(margaritaPizzaBuilder);
                waiter.ConstructPizza();
                pizza = waiter.GetPizza();
                pizza.Info();
                Console.ReadKey();
            }