public void EatFood()
        {
            #region old Code
            // 客户A想点一个西红柿炒蛋
            CreateFood foodA = CreateFoodFactory.DoCooking("西红寺炒蛋");
            foodA.GetFood();

            //客户B想点一个土豆肉丝
            CreateFood foodB = CreateFoodFactory.DoCooking("土豆肉丝");
            foodB.GetFood();
            #endregion

            #region new Code
            // 初始化做菜的两个工厂()
            CreatorFactory shreddedPorkWithPotatoesFactory = new ShreddedPorkWithPotatoesFactory();
            CreatorFactory tomatoScrambledEggsFactory      = new TomatoScrambledEggsFactory();

            // 开始做西红柿炒蛋
            CreateFood tomatoScrambleEggs = tomatoScrambledEggsFactory.CreateFoodFactory();
            tomatoScrambleEggs.GetFood();

            //开始做土豆肉丝
            CreateFood shreddedPorkWithPotatoes = shreddedPorkWithPotatoesFactory.CreateFoodFactory();
            shreddedPorkWithPotatoes.GetFood();

            #endregion
        }
        public static CreateFood DoCooking(string menuType)
        {
            CreateFood food = null;

            if (menuType.Equals("土豆肉丝"))
            {
                food = new ShreddedPorkWithPotatoes();
            }
            else if (menuType.Equals("西红柿炒蛋"))
            {
                food = new TomatoScrambledEggs();
            }
            return(food);
        }