What is the use of "static" keyword with Variables, functions and objects of classes etc? [duplicate]
Possible Duplicate:
static function/variable
Tell me the different combination of s开发者_Go百科tatic like object static and variable normal , or variable static function normal , object static function normal etc etc
A static variable and function are limited in scope they are declared in. Additionally, variables defined in functions will persist their value across function calls if defined as static.
A static method or member on an object can be used directly without a specific instance of the object, i.e. no this pointer will be automatically passed into the method. Naturally this means you can only access other static methods and variables from within a static method.
精彩评论