1. A regular class member variable (requires an instance of the class)
2. A class static member variable (doesn't require an instance of the class)
3. A file static variable. (Global to the file but not the whole program i.e. "file scope")
3. A "global" variable that resides in a namespace (the pig with lipstick solution)
4. A global variable (the pig without lipstick).
If you're a C programmer (not C++) you need to realize that the static keyword takes on an additional function in C++.
If you put in your .h file
Code: Select all
class YourClass
{
private:
static float someFloatVar_;
}
Code: Select all
float YourClass::someFloatVar_; //you should probably initialize it here as well =0.0 or whatever.