コード例 #1
0
        static void Main(string[] args)
        {
            Food f1 = FoodSimpleFactory.CreateFood("西红柿炒蛋");

            f1.CookPrint();

            Food f2 = FoodSimpleFactory.CreateFood("土豆肉丝");

            f2.CookPrint();

            Console.ReadLine();
        }
コード例 #2
0
        private static void Main(string[] args)
        {
            // 客户想点一个西红柿炒蛋
            Food food1 = FoodSimpleFactory.CreateFood("西红柿炒蛋");

            food1.Print();

            // 客户想点一个土豆肉丝
            Food food2 = FoodSimpleFactory.CreateFood("土豆肉丝");

            food2.Print();

            Console.Read();
        }