Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            IMarine marine1 = FactoryMarine.CreateMarine <BlueMarine>();

            marine1.Shot();

            IMarine marine2 = FactoryMarine.CreateMarine <RedMarine>();

            marine2.Shot();
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            IFactory factory = new BlueFactory();
            IMarine  marine  = factory.CreateMarine();
            IMedic   medic   = factory.CreateMedic();
            ITank    tank    = factory.CreateTank();

            marine.Shot();
            medic.Heal();
            tank.Move();

            factory = new RedFactory();
            IMarine marine2 = factory.CreateMarine();
            IMedic  medic2  = factory.CreateMedic();
            ITank   tank2   = factory.CreateTank();

            marine2.Shot();
            medic2.Heal();
            tank2.Move();


            Console.ReadLine();
        }