示例#1
0
        static void Main()
        {
            DerivedClass instance = new DerivedClass();
            instance.Method();

            // Delay.
            Console.ReadKey();
        }
        static void Main()
        {
            DerivedClass instance = new DerivedClass();

            instance.Method();

            // Delay.
            Console.ReadKey();
        }
示例#3
0
        static void Main()
        {
            DerivedClass instance = new DerivedClass();
            instance.Method();

            // UpCast
            BaseClass instanceUp = instance as BaseClass;
            instanceUp.Method();

            // DownCast
            DerivedClass instanceDown = instanceUp as DerivedClass;
            instanceDown.Method();

            // Delay.
            Console.ReadKey();
        }
        static void Main()
        {
            DerivedClass instance = new DerivedClass();

            instance.Method();

            // UpCast
            BaseClass instanceUp = instance as BaseClass;

            instanceUp.Method();

            // DownCast
            DerivedClass instanceDown = instanceUp as DerivedClass;

            instanceDown.Method();

            // Delay.
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            DerivedClass instace = new DerivedClass();

            instace.Method();
        }