Example #1
0
        private static void MethodHiding()
        {
            BaseClass bc = new BaseClass();
            bc.HideMethod();

            DerivedClass bc2 = new DerivedClass();
            bc2.HideMethod();

            BaseClass bc3 = new DerivedClass();
            bc3.HideMethod();
            Console.WriteLine(((DerivedClass)bc3).X);
        }
Example #2
0
        private static void MethodOverriding()
        {
            BaseClass bc = new BaseClass();
            bc.Foo();

            DerivedClass bc2 = new DerivedClass();
            bc2.Foo();

            BaseClass bc3 = new DerivedClass();
            bc3.Foo();

            bc = new DerivedClass();
            bc.Foo();
        }