示例#1
0
        static void Main(string[] args)
        {
            SimplePizzaFactory factory    = new SimplePizzaFactory();
            PizzaStore         pizzaStore = new PizzaStore(factory);
            Pizza pizza = pizzaStore.OrderPizza("cheese");


            Console.WriteLine(pizza.Prepare() + "\n" + pizza.Bake() + "\n" + pizza.Cut() + "\n" + pizza.Box());


            Console.ReadKey();
        }
示例#2
0
        public void CreateGoods()
        {
            string orderType = "";

            do
            {
                orderType = GetOrderType();
                pizza     = this.factory.CreatePizza(orderType);

                if (pizza != null)
                {
                    pizza.Prepare();
                    pizza.Bake();
                    pizza.Cut();
                    pizza.Box();
                }
                else
                {
                    Console.WriteLine("没有");
                    break;
                }
            } while (true);
        }