Пример #1
0
        static void Main(string[] args)
        {
            Zero fxs = new Zero();

            fxs.BatteryKWh       = 300;
            fxs.MainColor        = "Yellow";
            fxs.MaximumOccupancy = "2";

            Tesla modelS = new Tesla();

            modelS.MaximumOccupancy = "5";
            modelS.MainColor        = "Midnight Blue";
            modelS.BatteryKWh       = 250;

            Cessna mx410 = new Cessna();

            mx410.MainColor        = "Red";
            mx410.MaximumOccupancy = "2";
            mx410.FuelCapacity     = 31;


            Ram ram1500 = new Ram();

            ram1500.FuelCapacity     = 30;
            ram1500.MainColor        = "Black";
            ram1500.MaximumOccupancy = "4";

            fxs.Drive();
            fxs.Turn("right");
            fxs.Stop();
            Console.WriteLine("");

            modelS.Drive();
            modelS.Turn("left");
            modelS.Stop();
            Console.WriteLine("");


            mx410.Drive();
            mx410.Turn("right");
            mx410.Stop();
            Console.WriteLine("");


            ram1500.Drive();
            ram1500.Turn("left");
            ram1500.Stop();

            Console.WriteLine("");
        }
Пример #2
0
        static void Main(string[] args)
        {
            // Create an instance of each vehicle.
            Zero zero = new Zero();

            zero.MainColor        = "red";
            zero.MaximumOccupancy = "2";

            Cessna cessna = new Cessna();

            cessna.MainColor        = "blue";
            cessna.MaximumOccupancy = "3";

            Tesla tesla = new Tesla();

            tesla.MainColor        = "red";
            tesla.MaximumOccupancy = "4";

            Ram ram = new Ram();

            ram.MainColor        = "black";
            ram.MaximumOccupancy = "6";

            zero.Drive();
            ram.Drive();
            tesla.Drive();
            cessna.Drive();

            zero.Turn();
            zero.Stop();
            ram.Turn();
            ram.Stop();
            tesla.Turn();
            tesla.Stop();
            cessna.Turn();
            cessna.Stop();
        }