分类: C/C++
2011-07-27 10:51:53
The keyword static has many different meanings in C++. The table show how static can be used.
Usage | Meaning |
---|---|
Variable outside the body of any function | The scope of the variable is limited to the file in which it is |
Variable declaration inside a function | The variable is permanent. It is initialized once, and only one |
Function declaration | The scope of the function is limited to the file in which it is |
Member variable | One copy of the variable is created per class (not one per |
Member function | Function can only access static members of the class. |