In C + + classes, static data members and (static) function members defined by static are classes, whereas members and functions that are not defined by static are called instance data members and instance function members, and they belong to an instance (object).
In memory, a static data member of a class occupies a specific memory space and is shared by all instances (objects) of that class. Instance data members of different objects of the same class are independent of each other and occupy their own storage space.
After you define a class, you must define static data members in the scope of the file outside the class, that is, allocate storage space for them.
You can use the class name and domain resolution operators directly in your program: direct access to common static data members and common function members of a class, and cannot directly access private members of a class.
You cannot initialize a static data member in a class's constructor, because a static data member does not belong to a specific class.
In a static function member of a class, you can access only the static data members of the class, not the instance data members of the class, because a concrete instance (object) of the class may not have been created when a static function member is called.
The difference between a static member and an instance member of a class in C + +