예제 #1
0
        public static void Casts_Between_Classes()
        {
            CastDeriveClass1 cdc1 = new CastDeriveClass1(1, 2);
            CastDeriveClass2 cdc2 = new CastDeriveClass2(3, 4);
            CastDeriveClass1 cdc3 = (CastDeriveClass1)cdc2;

            Console.WriteLine(cdc1.ToString());
            Console.WriteLine(cdc2.ToString());
            Console.WriteLine(cdc3.ToString());
        }
예제 #2
0
        public static void Casts_Between_Classes()
        {
            CastDeriveClass1 cdc1 = new CastDeriveClass1(1, 2);
            CastDeriveClass2 cdc2 = new CastDeriveClass2(3, 4);
            CastDeriveClass1 cdc3 = (CastDeriveClass1)cdc2;

            Console.WriteLine(cdc1.ToString());
            Console.WriteLine(cdc2.ToString());
            Console.WriteLine(cdc3.ToString());
        }