Exemple #1
0
        static void Main(string[] args)
        {
            Car         car        = new Car();
            IDriver     driver     = (IDriver)car;
            IMechanical mechanical = (IMechanical)car;

            driver.Drive();
            mechanical.Maintain();

            DriveACar(car);
            MaintainCar(car);
        }
 //自動車をメンテナンスする
 static void MaintainACar(IMechanical car)
 {
     //car.Drive();
     car.Maintain();
 }
Exemple #3
0
 static void MaintainCar(IMechanical mechanical)
 {
     mechanical.Maintain();
 }
Exemple #4
0
 static void MaintainACar(IMechanical im)
 {
     im.Maintain();
 }