예제 #1
0
파일: Program.cs 프로젝트: bgu609/portfolio
        static void Main(string[] args)
        {
            FlyingCar car = new FlyingCar();

            car.Run();
            car.Fly();

            IRunnable runnable = car as IRunnable;

            runnable.Run();

            IFlyable flyable = car as IFlyable;

            flyable.Fly();
        }
예제 #2
0
        static void Main(string[] args)
        {
            FlyingCar car = new FlyingCar();

            car.Run();
            car.Fly();
            car.Company = "현대";

            IRunnable runnable = car as IRunnable;      //형변환, 형변환 안되면 null값 들어감

            runnable.Run();

            IFlyable flyable = car as IFlyable;

            flyable.Fly();
        }