示例#1
0
        public Client()
        {
            Console.WriteLine("type? 1/2: ");
            int i = int.Parse(Console.ReadLine());

            if (i == 1)
            {
                factory = new Factory1();
            }
            else
            {
                factory = new Factory2();
            }
            factory.CreateProductA().GetName();
            classB = factory.CreateProductB();
            classB.GetName();
        }