Sobes.tech
Junior — Senior

Type casting issues and method hiding in inheritance

livecode

Task condition

What is the reason why this code fragment does not compile?

class B
    {
        public void F() {Console.WriteLine("B.F");}
    }

    class C : B
    {
        public void F() { Console.Write("C.F");}

        public static void // PrintStuff()
        {
            C x = new B(); x.F();
        }
    }