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(); }
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); }