コード例 #1
0
        static void Main(string[] args)
        {
            // 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); // default 0
            car.Start();
            car.SteerLeft();

            Console.WriteLine(car.IsOn);

            //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("Moto2");
            Motorbike moto2 = new Motorbike(true);

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

            car.Left();
            Console.WriteLine("Car steering left");
            car.Right();
            Console.WriteLine("Car steering right");


            Boat boat = new Boat();

            boat.Left();
            Console.WriteLine("boat steering left");
            boat.Right();
            Console.WriteLine("Boat steering right");

            moto.Left();
            Console.WriteLine("Moto steering left");
            moto.Right();
            Console.WriteLine("Moto steering right");
        }
コード例 #2
0
        static void Main(string[] args)
        {
            //Car car1 = new Car(true);
            //car1.IsON = false;

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

            Console.WriteLine(car.IsON);
            car.Stop();
            car.SteerLeft(true);
            car.SteerRight(false);
            car.Steer(true);
            car.Break();
            car.Reverse();
            Console.WriteLine(car.IsON);

            Console.WriteLine("Moto");
            Motorbike moto = new Motorbike();

            moto.Stop();
            Console.WriteLine(moto.IsON);
            moto.SteerLeft(true);
            moto.SteerRight(false);
            moto.Steer(true);
            moto.Break();
            moto.Reverse();
            Console.WriteLine("Boat");
            Boat boat = new Boat();

            boat.Stop();
            boat.SteerLeft(true);
            boat.SteerRight(false);
            boat.Steer(true);
            boat.Break();
            boat.Reverse();
            Console.WriteLine(moto.IsON);

            //boat.SteerLeft(true);
            //boat.SteerRight(false);

            Console.WriteLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: MammosGeorgios/Interfaces
        static void Main(string[] args)
        {
            
            Car car = new Car();
            car.Start();
            Console.WriteLine(car.IsOn);
            car.Stop();
            Console.WriteLine(car.IsOn);
            car.TurnLeft();
            car.TurnRight();
            car.Reverse();
            car.Turn(true);

            Motorbike bike = new Motorbike();

            bike.Start();
            Console.WriteLine(car.IsOn);
            bike.Stop();
            Console.WriteLine(car.IsOn);
            bike.TurnLeft();
            bike.TurnRight();
            bike.Reverse();
            bike.Turn(true);

            Boat boat = new Boat();

            boat.Start();
            Console.WriteLine(car.IsOn);
            boat.Stop();
            Console.WriteLine(car.IsOn);
            boat.TurnLeft();
            boat.TurnRight();
            boat.Reverse();
            boat.Turn(true);




        }