コード例 #1
0
ファイル: Program.cs プロジェクト: artyomShepovalov/123
    static void Main()
    {
        Maker[] Makers = new Maker[3];
        Makers[0] = new ConcreteMakerA();
        Makers[1] = new ConcreteMakerB();
        Makers[2] = new ConcreteMakerC();

        foreach (Maker Maker in Makers)
        {
            Product product = Maker.FactoryMethod();
            Console.WriteLine("Created {0}", product.GetType().Name);
        }
        Console.Read();
    }
コード例 #2
0
    static void Main()
    {
        Maker[] Makers = new Maker[3];
        Makers[0] = new ConcreteMakerA();
        Makers[1] = new ConcreteMakerB();
        Makers[2] = new ConcreteMakerC();

        foreach (Maker Maker in Makers)
        {
            Product product = Maker.FactoryMethod();
            Console.WriteLine("Created {0}", product.GetType().Name);
        }
        Console.Read();
    }