static void Main(string[] args) { FlyingCar car = new FlyingCar(); car.Run(); car.Fly(); IRunnable runnable = car; runnable.Run(); IFlyable flyable = (IFlyable)car; flyable.Fly(); }
static void Main(string[] args) { FlyingCar car = new FlyingCar(); car.Run(); car.Fly(); IRunnable runable = car; runable.Run(); IFlyable flyable = new FlyingCar(); flyable.Fly(); FlyingCar car2 = flyable as FlyingCar; car2.Run(); car2.Fly(); }