[Mono-bugs] [Bug 78602][Nor] New - Can't access protected property in base class of outer class when inner class inherits the same base class

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jun 7 10:54:16 EDT 2006


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 bhawes at fotango.com.

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

--- shadow/78602	2006-06-07 10:54:16.000000000 -0400
+++ shadow/78602.tmp.31915	2006-06-07 10:54:16.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 78602
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: bhawes at fotango.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Can't access protected property in base class of outer class when inner class inherits the same base class
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+When an inner class inherits the same base class as the outer class, 
+attempting to access a protected property in the base of an instance of 
+the outer class from within the inner class fails compilation with error 
+CS1540.
+
+Steps to reproduce the problem:
+1. Attempt to compile the following code:
+using System;
+class Base
+{
+	protected string H {
+		get {
+			return "Base.H";
+		}
+	}
+}
+class Derived: Base
+{
+	public class Nested : Base
+	{
+		public void G() {
+			Derived d = new Derived();
+			Console.WriteLine(d.H);
+		}
+	}
+}
+class Test
+{
+	static void Main() {
+		Derived.Nested n = new Derived.Nested();
+		n.G();
+	}
+}
+2. 
+3. 
+
+Actual Results:
+
+MonoTest.cs(16,22): error CS1540: Cannot access protected member `Base.H' 
+via a qualifier of type `Derived'; the qualifier must be of type 
+`Derived.Nested' (or derived from it)
+Compilation failed: 1 error(s), 0 warnings
+Expected Results:
+
+Successful compilation
+
+How often does this happen? 
+
+Always
+
+Additional Information:
+
+The code compiles using the Microsoft .NET SDK compiler.


More information about the mono-bugs mailing list