Selasa, 15 Juni 2010
Hide and seek
Another interesting question from StackOverflow. That thing is a gold mine for blog topics. Consider the following:class B{ public int X() { return 123; }}class D : B{ new protected int X() { return 456; } }class E : D{ public int Y() { return X(); } // returns 456}class P{ public static void Main() { D d = new D(); Console.WriteLine(d.X()); }}There are two possible behaviours here.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar