public static Food CreateFood(string type) { Food food = null; if (type.Equals("土豆肉丝")) { food = new ShreddedPorkWithPotatoes(); } else if (type.Equals("西红柿炒蛋")) { food = new TomatoScrambledEggs(); } return food; }