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(); }
static void MaintainCar(IMechanical mechanical) { mechanical.Maintain(); }
static void MaintainACar(IMechanical im) { im.Maintain(); }