Exemple #1
0
        static void Main(string[] args)
        {
            VehiculoFactory factory = new VehiculoFactory();

            IVehiculo vehiculoMoto = factory.CreateInstance("Moto");

            if (vehiculoMoto == null)
            {
                return;
            }

            IVehiculo vehiculoCarro = factory.CreateInstance("Carro");

            if (vehiculoCarro == null)
            {
                return;
            }

            IVehiculo vehiculoBus = factory.CreateInstance("Bus");

            if (vehiculoBus == null)
            {
                return;
            }

            Console.WriteLine(vehiculoMoto.ObtenerInfo());
            Console.WriteLine(vehiculoCarro.ObtenerInfo());
            Console.WriteLine(vehiculoBus.ObtenerInfo());
            Console.ReadLine();
        }