From: Bob J. <Bob...@lb...> - 2008-06-30 00:42:29
|
At 7:32 PM -0400 6/29/08, Ken Cameron wrote: >I'm getting 'static reference to a non-static' >regardless of how I try this. Look at the method that contains the reference. If it's marked by "static" in the type declaration (basically, where the return type is defined), then it's more of a procedure call than something associated with a particular object. Static methods don't have a "this" pointer, and can't directly reference variables within objects (there are exceptions, which are conceptually somewhat clean but not really relevant here). To put it another way, everything that a static method references directly must also be declared as static. >My concern for keeping the creation of these two arrays together was to >insure the order of the elements stay in sync so they can be used >together and the index in one would match the other and the reverse too. Might be better to define a small internal class that keeps the two items, and then have an array of those. That idiom makes it much easier to ensure things stay synchronized. But that's not the issue that's causing the error message. Bob -- Bob Jacobsen, UC Berkeley jac...@be... +1-510-486-7355 fax +1-510-643-8497 AIM, Skype JacobsenRG |