Microsoft KB Archive/160113

= FIX: Error Generated when Variable and Method Have Same Name =

Article ID: 160113

Article Last Modified on 5/12/2007

-

APPLIES TO


 * Microsoft Visual J++ 1.0 Standard Edition

-



This article was previously published under Q160113



SYMPTOMS
When a class contains a variable and method of the same name and the variable is accessed using the "this" object reference, the compiler generates the following error message thinking you are trying to access the method:

Error J0070: need argument list for call to member "XXX"

Where XXX is the variable or method.



WORKAROUND
Do not access the variable using the "this" object reference. You can use the name directly.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual J++ 1.1.



Steps to Reproduce Problem

 * 1) Compile the following code:

//[Test.java] class Test {  int Same; void Same {  }   void Bar {     this.Same = 1;

// to avoid the error, remove the "this" object // reference, like the following // Same = 1; } } You will get the following error message:

error: J0070: Need argument list for call to member 'void Same'

