예제 #1
0
        public static void Main(String[] args)
        {
            Dog dog        = new Dog();
            Dog deshiDog   = new DeshiDog();
            Dog bideshiDog = new BideshiDog();

            dog.swirl();

            DeshiDog redwan = (DeshiDog)deshiDog;       // Downcasting

            redwan.swirl_1();

            ((BideshiDog)bideshiDog).swirl_2();     // Downcasting
        }
        public static void Main(String[] args)
        {
            Dog dog        = new Dog();
            Dog deshiDog   = new DeshiDog();
            Dog bideshiDog = new BideshiDog();

            dog.swirl();
            //deshiDog.swirl_1();   //i can not call this. because this method did not override.

            DeshiDog redwan = (DeshiDog)deshiDog;       // Downcasting

            redwan.swirl_1();

            ((BideshiDog)bideshiDog).swirl_2();     // Downcasting
        }