コード例 #1
0
ファイル: Program.cs プロジェクト: chris1287/Design-patterns
        static void Main(string[] args)
        {
            AbstractFactory factory1 = new Factory1();
            AbstractFactory factory2 = new Factory2();

            Client client1 = new Client(factory1);
            Client client2 = new Client(factory2);

            client1.Run();
            client2.Run();

            Console.ReadKey();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Factory factory1 = new Factory1();
            Factory factory2 = new Factory2();

            ProductA productA1 = factory1.CreateProductA();

            productA1.Operation();
            ProductB productB1 = factory1.CreateProductB();

            productB1.Operation();

            ProductA productA2 = factory2.CreateProductA();

            productA2.Operation();
            ProductB productB2 = factory2.CreateProductB();

            productB2.Operation();
        }