//static void FactoryMethod() //{ // IFruitFactory appleFac = new AFactory(); // Fruit apple = appleFac.CreateFruit(); // apple.PrintfColor(); // apple.PrintfName(); // IFruitFactory orangeFac = new OrangeFactory(); // Fruit orage = orangeFac.CreateFruit(); // orage.PrintfColor(); // orage.PrintfName(); //} void SimpleFactory() { Console.WriteLine("请选择操作符号(+、-、*、/)"); string operateStr = Console.ReadLine(); Operate operate = OperateFactory.GetOperateFactory(operateStr); operate.NumberA = 10; operate.NumberB = 4; double result = operate.GetResult(); Console.WriteLine(result); Console.ReadKey(); }