static void Main(string[] args)
        {
            // NO NO can't have instances of an abstract class or interface
            //AutoMobile auto = new AutoMobile();

            Console.WriteLine("car c");
            Car c = new Car(true);

            c.SteerLeft();

            Console.WriteLine("car car");
            Car car = new Car();

            Console.WriteLine(car.IsOn);
            car.Start();
            car.SteerLeft();
            Console.WriteLine(car.IsOn);

            // with private set doesn't work
            //car.IsOn = false;

            car.Stop();
            Console.WriteLine(car.IsOn);

            Console.WriteLine("motorbike moto");
            MotorBike moto = new MotorBike();

            moto.Start();
            moto.SteerLeft();
            Console.WriteLine(moto.IsOn);

            Console.WriteLine("motorbike moto2");
            MotorBike moto2 = new MotorBike(true);

            Console.WriteLine(moto2.IsOn);
            moto2.SteerLeft();
            moto2.Stop();
            Console.WriteLine(moto2.IsOn);

            Console.ReadLine();


            Console.WriteLine("-----------");
            Boat boat = new Boat();

            boat.Steer(true);
            boat.Steer(true);
            boat.Steer(false);
            Console.WriteLine(boat.Steers);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Car c");
            Car c = new Car(true);

            c.SteerLeft();
            c.SteerRight();
            c.Stop();

            Console.WriteLine("car car");
            Car car = new Car();

            car.Start();
            Console.WriteLine(car.IsOn);
            car.SteerLeft();
            car.SteerRight();
            //with private set it doesnt work
            //car.IsOn = false;
            car.Stop();
            Console.WriteLine(car.IsOn);


            Console.WriteLine("MotorBike moto");
            MotorBike moto = new MotorBike();

            moto.Start();
            Console.WriteLine(moto.IsOn);
            moto.SteerLeft();

            Console.WriteLine("MotorBike moto2");
            MotorBike moto2 = new MotorBike(true);

            Console.WriteLine(moto2.IsOn);
            moto2.SteerLeft();
            moto2.Stop();
            Console.WriteLine(moto2.IsOn);


            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Cars      car   = new Cars(true);
            MotorBike motor = new MotorBike(true);
            Boat      boat  = new Boat();

            car.Steer();
            car.SteerLeft(true);
            car.SteerRight(false);
            car.directio(true, false);
            car.Reverse();

            motor.Steer();
            motor.SteerLeft(true);
            motor.directio(true, true);
            motor.SteerRight(false);

            boat.Steer();
            boat.SteerLeft(true);
            boat.directio(false, true);
            boat.SteerRight(false);
            boat.Reverse();



            motor.Start();
            Console.WriteLine(motor.IsOn);
            motor.SteerLeft(false);
            motor.Stop();
            Console.WriteLine(motor.IsOn);

            car.Start();
            Console.WriteLine(car.IsOn);

            car.Stop();
            Console.WriteLine(car.IsOn);

            Console.ReadLine();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("car: c");
            Car c = new Car();

            Console.WriteLine(c.IsOn);
            c.Start();
            c.SteerLeft();
            c.SteerRight();
            c.Reverse();
            c.Break();
            c.Stop();
            Console.WriteLine(c.IsOn);

            Console.WriteLine("motorbike: m");
            MotorBike m = new MotorBike();

            Console.WriteLine(m.IsOn);
            m.Start();
            m.SteerLeft();
            m.SteerRight();
            m.Break();
            m.Stop();
            Console.WriteLine(m.IsOn);

            Console.WriteLine("boat: b");
            Boat b = new Boat();

            Console.WriteLine(b.IsOn);
            b.Start();
            b.SteerLeft();
            b.SteerRight();
            b.Reverse();
            b.Stop();
            Console.WriteLine(b.IsOn);
        }