예제 #1
0
        static void Main(string[] args)
        {
            IFactory factory = new FactoryA();//需要产品B时更改类型即可**********推送修改
            //IFactory factory = new FactoryA();

            Product pA = factory.CreateProduct();

            pA.Function();

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Factory factoryA = new FactoryA();
            Product productA = factoryA.CreateProduct();

            productA.Operation();

            Factory factoryB = new FactoryB();
            Product productB = factoryB.CreateProduct();

            productB.Operation();
        }