[Mono-bugs] [Bug 22721] New - Error in hiding inherited members

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
28 Mar 2002 21:47:59 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by duco@lorentz.xs4all.nl.

http://bugzilla.ximian.com/show_bug.cgi?id=22721

--- shadow/22721	Thu Mar 28 16:47:59 2002
+++ shadow/22721.tmp.5490	Thu Mar 28 16:47:59 2002
@@ -0,0 +1,60 @@
+Bug#: 22721
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: SuSE Linux 7.1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: duco@lorentz.xs4all.nl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Error in hiding inherited members
+
+Description of Problem:
+Declaration of a private member in a subclass should not hide an inherited
+public member
+
+Steps to reproduce the problem:
+using System;
+
+class Base {
+        public void F () { Console.WriteLine ("Base.F"); }
+}
+
+class Derived : Base {
+        new private void F () { Console.WriteLine("Derived.F"); }
+}
+
+class MoreDerived : Derived {
+        public void G () { F (); }
+}
+
+class Test {
+
+        public static void Main ()
+        {
+                MoreDerived m = new MoreDerived ();
+
+                m.G ();
+        }
+}
+
+Actual Results:
+The program prints "Derived.F": the call to F in MoreDerived.G resolves to
+Derived.F.
+
+Expected Results:
+That call should resolve to Base.F (the program should print "Base.F").
+
+How often does this happen? 
+Always
+
+Additional Information:
+This bug is (probably) related to the fact that accessibility is not 
+currently checked by mcs.