Would you please provide us a context here?
Are you talking about Java or Objective-C?
Joined: Aug 11, 2010
i m talking about objective c i think only way is by passing a parameter to that method
like if numberOfSides is nonstatic instance variable then we can pass it like
Joined: Jan 28, 2008
I believe that passing it (or the object it exists in) as a parameter is the only way to do so. An instance variable exists in an object, and there might be multiple objects of the same class, the static method will never know what to use, hence it's not allowed in the language, and it will not compile if you try to access an instance variable (or invoke an instance method) from a static method. (this applies to Java as well)