コード例 #1
0
        static void Main()
        {
            ICar car = new Benz();

            car.Break();
            car.Engine();


            car = new Toyota();
            car.Break();
            car.Engine();

            car = new Maruti();
            car.Break();
            car.Engine();

            Benz Bcar = new Benz();

            Bcar.BenzFunctionality();

            Toyota Tcar = new Toyota();

            Tcar.ToyotaFunctionality();

            Console.Read();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Toyota myObj = new Toyota();

            myObj.make = "Ford";
            myObj.year = "2016";
            myObj.PrintModel();
            myObj.PrintEngineSize();
            Console.WriteLine($"{myObj.make}");

            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Toyota toyota = new Toyota();

            toyota.LoadFuel(600);



            Console.WriteLine(toyota.fuel);

            // Console.WriteLine("Hello World!");
        }
コード例 #4
0
        static void Main()
        {
            Toyota T = new Toyota();
            Benz   B = new Benz();

            Console.WriteLine("toyota brake : {0}", T.Brake());
            T.Engine();
            T.ToyotaFunctionality();
            Console.WriteLine("benz brake : {0}", B.Brake());
            B.Engine();
            B.BenzFunctionality();
            Console.Read();
        }
コード例 #5
0
        static void Main()
        {
            Benz benz = new Benz();

            Console.WriteLine("type of break {0}", benz.Break());
            Console.WriteLine("engine type is {0}", benz.Engine());
            benz.BenzFunctionality();

            Toyota toyota = new Toyota();

            Console.WriteLine("type of break {0}", toyota.Break());
            Console.WriteLine("engine type is {0}", toyota.Engine());
            toyota.ToyotaFunctionality();
            Console.Read();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Car toyota = new Toyota();

            toyota.Accelerate();
            toyota.Run();

            Car ferrari = new Ferrari();

            ferrari.Accelerate();

            ferrari.Run();
            ferrari.Stop();
            Ferrari realFerrari = (Ferrari)ferrari;

            realFerrari.Stop();
        }