Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Static objects are distinguished from stack variables and heap variables in that their storage is fixed and allocated by the linker, and their lifetimes are (largely) independent from the execution flow of the process. Static objects fall into three categories.
Function-local static variables are those that are defined within function scope.
Global and namespace-global static variables—also known as nonlocal statics—are those that are defined in the global namespace or within a named or anonymous namespace.
Static member variables are those that are shared between instances of the class within which they're defined.