[Chapter III] c ++ study notes 2 (a static member variables)

Static member: Before adding a description of the object static keyword
usage example:

basic concepts
common member variables of each object has its own copy, but a total of only a static member variables, all shared objects.
Ordinary members have the specific role and function of an object, but not the specific role of static member function of an object and
how to access static member

static member variable is a global variable in nature, even if an object does not exist, static member variables like there
global function is essentially a static member function
to set a static member of such a mechanism is the purpose of the global variables and functions and certain types of closely related classes written inside, looks more like a whole, easy to maintain and understand
Note

Guess you like

Origin www.cnblogs.com/lamia76/p/12328041.html