quote:Original post by Mage2kquote:Original post by TibreUmmm... not quite. I think a better way to word it is that you can only call non-static methods with a valid reference to an object that has been created with new. Static methods are class operations and non-static methods are object operations.
The short answer is like this. When you declare a method as static, you''re saying that there doesn''t have to be an instance of that object in order to call that method. Therefore, it can''t access any non-static variables or call any non-static functions. This is because the compiler has know way of knowing whether or not those non-static functions access non-static variables themselves. The only way it can know for certain that the function you are calling is doesn''t access any non-static variables, is if it is static too.
...
peace and (trance) out
Mage
Ok... yeah, I agree. That is a better way to word it. I guess what I should''ve said was ''If you are in a static method, the only variables and methods you can access are: other static methods and static members of the class you belong to, or ANY public method or variable of a specific object''.
I guess sometimes the short answer isn''t adequate. ;P