Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var vehicleFactory = new VehicleFactory();

            IVehicle vehicleCar = vehicleFactory.ProduceVehicle(VehicleType.Car);

            vehicleCar.DisplayInfo();

            IVehicle vehicleMotorcycle = vehicleFactory.ProduceVehicle(VehicleType.Motorcycle);

            vehicleMotorcycle.DisplayInfo();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var vehicleFactory = new VehicleFactory();

            IVehicle v1 = vehicleFactory.ProduceVehicle(VehicleType.Car);

            v1.DisplayInfo();
            v1.getNumber();

            Console.WriteLine("--------------------");

            IVehicle v2 = vehicleFactory.ProduceVehicle(VehicleType.Motorcycle);

            v2.DisplayInfo();
            v2.getNumber();

            Console.WriteLine("--------------------");

            IVehicle v3 = vehicleFactory.ProduceVehicle(VehicleType.Ship);

            v3.DisplayInfo();
            v3.getNumber();
        }