The static keyword has been extended in C++ to have the following meanings.
| C++ Context | Action | 
|---|---|
| A variable outside of a function. | Variable can be seen by all functions in the file. Default. | 
| Variable inside a function. | The variable is permanent. The variable can only be initalised once and only one copy of the variable exists. Recursive calls use the same variable. | 
| A class member variable | Only one copy of the variable exists. All instances of the object use the same variable (memory location). | 
| A class member function (method). | Function can only access static members of the class | 
 No example programs yet.
No example programs yet.
| Top | Master Index | C++ Keywords | Functions |