Beispiel #1
0
        static void Main()
        {
            IEngine e1 = new StandardEngine(1300);
            IEngine e2 = new TurboEngine(1600);

            IVehicle v1 = new Saloon(e1);
            IVehicle v2 = new Coupe(e1, VehicleColour.Blue);
            IVehicle v3 = new BoxVan(e2, VehicleColour.White);

            Console.WriteLine(v1);
            Console.WriteLine(v2);
            Console.WriteLine(v3);
            Console.Read();
        }
Beispiel #2
0
        static void Main()
        {
            IEngine e1 = new StandardEngine(1300);
            IEngine e2 = new TurboEngine(1600);

            IVehicle v1 = new Saloon(e1);
            IVehicle v2 = new Coupe(e1, VehicleColour.Blue);
            IVehicle v3 = new BoxVan(e2, VehicleColour.White);

            Console.WriteLine(v1);
            Console.WriteLine(v2);
            Console.WriteLine(v3);
            Console.Read();
        }
Beispiel #3
0
        protected internal override IVehicle SelectVehicle(DrivingStyle style)
        {
            IVehicle selectedVehicle;

            if (style == DrivingStyle.Economical)
            {
                selectedVehicle = new Saloon(new StandardEngine(1300));

            }
            else if (style == DrivingStyle.Midrange)
            {
                selectedVehicle = new Coupe(new StandardEngine(1600));

            }
            else
            {
                selectedVehicle = new Sport(new TurboEngine(2000));
            }

            return selectedVehicle;
        }