Exemplo n.º 1
0
        static void Main()
        {
            AbstractFactory factory1 = new ConcreteFactory();
            Player player = new Player(factory1);

            player.Run();
            AbstractFactory factory2 = new ConctreteEnemyFactory();

            Player enemy = new Player(factory2);
            enemy.Run();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            AbstractFactory factory = new ConcreteFactory();

            AbstractProductA productA = factory.CreateProductA();
            AbstractProductB productB = factory.CreateProductB();

            productB.Interact(productA);

            Console.ReadLine();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            ConcreteFactory factory = new ConcreteFactory();
            Example example1 = Create(factory);

            OtherConcreteFactory otherFactory = new OtherConcreteFactory();
            Example example2 = Create(otherFactory);

            System.Console.WriteLine("- Factory:");
            example1.Print();

            System.Console.WriteLine("- Other factory:");
            example2.Print();

            System.Console.ReadLine();
        }