C++ Programming/Programming Languages/C++/Code/Keywords/static/Data Member

static data member
The use of the specifier in a data member, will cause that member to be shared by all instances of the owner class and derived classes. To use static data members you must declare the data member as static and initialize it outside of the class declaration, at file scope.

When used in a class data member, all instantiations of that class share one copy of the variable.

In the example above, the static class variable numFoos is shared between all three instances of the Foo class (f1, f2 and f3) and keeps a count of the number of times that the Foo class has been instantiated.