public: static int count;
- All objects that try to access their count member variable actually refer to the only class-bound static count variable.
- The variable is allocated only once, regardless of how many objects are instantiated, because it is bound to the class itself, not its instances.
- The variable existd when no objects of the class have been defined, so it can be modified at any point in the source code.
- The variable cannot be modified by any part of the code in the same application or thread. However, other threads may modify it.
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.