Exemple #1
0
    static void Main(string[] args)
    {
        ICar seat  = new Seat("Leon", "Grey");
        ICar tesla = new Tesla("Model 3", "Red", 2);

        Console.WriteLine(seat.ToString());
        seat.Start();
        seat.Stop();
        Console.WriteLine(tesla.ToString());
        tesla.Start();
        tesla.Stop();
    }
            static void Main(string[] args)
            {
                var gasVehicle = new Toyota();

                gasVehicle.Start(0);     // needs to implement the Start method in Toyota Class
                gasVehicle.Speed(70, 1); // needs to implement the Speed method in Toyota Class
                gasVehicle.Stop();       // needs to implement the Stop methos in Toyota Class

                var electricalVehicle = new Tesla(true);

                electricalVehicle.Start(1);             // uses over ridden method in Testa Class
                electricalVehicle.Speed(90, 1);         // internal method
                electricalVehicle.Stop();               //code reuse from the Vehicle abstract class
                var virtulaVehicle = new Vehicle(true); //  will not work as this a abstract class
            }