[Mono-bugs] [Bug 52458][Wis] New - Scope problem when overriding private method in nested type

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 22 Dec 2003 16:00:06 -0500 (EST)


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 bmaurer@users.sf.net.

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

--- shadow/52458	2003-12-22 16:00:06.000000000 -0500
+++ shadow/52458.tmp.9908	2003-12-22 16:00:06.000000000 -0500
@@ -0,0 +1,49 @@
+Bug#: 52458
+Product: Mono/Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Scope problem when overriding private method in nested type
+
+This should not compile:
+
+using System;
+
+class A {
+	public virtual int Blah () { return 1; }
+}
+
+class B : A {
+	new int Blah () { return 0; }
+	
+	class C : B {
+		
+		public override int Blah () { return 2; }
+		static void Main () {
+			Console.WriteLine (new C ().Blah ());
+		}
+	}
+}
+
+B.Blah is closer to C.Blah than A.Blah is. We are ignoring it because we
+just ignore the private methods.
+
+On csc you get:
+
+t.cs(14,23): error CS0506: 'B.C.Blah()' : cannot override inherited member
+'B.Blah()' because it is not marked virtual, abstract, or override
+t.cs(10,10): (Location of symbol related to previous error)
+t.cs(14,23): error CS0507: 'B.C.Blah()': cannot change access modifiers
+when overriding 'private' inherited member 'B.Blah()'t.cs(10,10): (Location
+of symbol related to previous error)