Пример #1
0
        public static void Main()
        {
            var car = new Car(4, 7, 4);
            var motor = new Motor(70, 5);
            var sportCar = new SportVehicle(new Car(2, 17, 0));
            var sportMotor = new SportVehicle(new Motor(0, 13));

            Console.WriteLine("car: " + car.Show());
            Console.WriteLine("-----------------");
            Console.WriteLine("motor: " + motor.Show());
            Console.WriteLine("-----------------");
            Console.WriteLine("sport car: " + sportCar.Show());
            Console.WriteLine("-----------------");
            Console.WriteLine("sport motor: " + sportMotor.Show());
            Console.WriteLine("-----------------");

            sportCar.MoveForward();
            sportMotor.MoveBackward();

            car.MoveForward();
            motor.MoveBackward();

            Console.WriteLine("-----------------------------------------");
        }
Пример #2
0
 public OptionAlloyWheels(Car car)
 {
     _car = car;
 }
Пример #3
0
 public OptionLeather(Car car)
 {
     _car = car;
 }
Пример #4
0
 public OptionTurbo(Car car)
 {
     _car = car;
 }