[Mono-bugs] [Bug 49539][Nor] New - Overloading a field with a method of the same name gives a compile time

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 10 Oct 2003 19:09:48 -0400 (EDT)


error
In-Reply-To: <bug-49539@chernobyl.ximian.com>
X-Bugzilla-Product: Mono/MCS
X-Bugzilla-Component: Misc
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: Normal
X-Bugzilla-Severity: 
X-Bugzilla-Target-Milestone: ---

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 baskmau@hotmail.com.

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

--- shadow/49539	2003-10-10 19:09:48.000000000 -0400
+++ shadow/49539.tmp.16144	2003-10-10 19:09:48.000000000 -0400
@@ -0,0 +1,56 @@
+Bug#: 49539
+Product: Mono/MCS
+Version: unspecified
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: baskmau@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Overloading a field with a method of the same name gives a compile time
+error
+
+Description of Problem:
+
+Overloading a field with a method of the same name gives a compile time
+error -- java allows this but I am not sure if the C# language forbids it.
+
+Steps to reproduce the problem:
+
+Trying to compile the following code results in a compiler error:
+
+using System;
+
+public class OverLoad
+{
+   bool Tool;
+   bool Tool( string s )
+   {
+      return true;
+   }
+
+   public static void Main()
+   {
+      OverLoad test = new OverLoad();
+      test.Tool = false;
+      test.Tool = test.Tool( "Hello" );
+      Console.WriteLine( test.Tool );
+   }
+}
+
+Actual Results:
+
+Overload.cs(6) error CS0102: The container `OverLoad' already contains a
+definition for `Tool'
+Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+
+Should this compile per spec ( sorry for RTFS )?