[Mono-bugs] [Bug 36951][Nor] New - Children can access Parent's private fields

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Mon, 20 Jan 2003 00:13:27 -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 seank@users.sf.net.

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

--- shadow/36951	Mon Jan 20 00:13:27 2003
+++ shadow/36951.tmp.8836	Mon Jan 20 00:13:27 2003
@@ -0,0 +1,43 @@
+Bug#: 36951
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: seank@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Children can access Parent's private fields
+
+Description of Problem:
+mcs allows child classes to access their parent's private fields.
+
+Steps to reproduce the problem:
+
+using System;
+public class Parent
+{
+  Parent() { Val=10; }
+  private int Val;
+}
+public class Child : Parent
+{
+  Child() { Console.WriteLine(Val); }
+}
+
+Actual Results:
+Compilation suceeded
+
+Expected Results:
+error CS0122:  'Parent.Val' is inaccessible due to its protection level
+
+
+Additional Information:
+bug 35631 seems to be a side effect of this bug.