1. static member variables in C ++ are part of the class, but they are not part of each object of the class.
A static member has only one unique copy, but each object does not have a copy as a regular non-static member.
Similarly, a function that needs to be called for a specific object but does not need to be a static member function.
2. Static members can also be referenced like any other member. In addition, reference to static members does not need to mention any objects. On the contrary, you should add a class name as a qualified word to the member name.
(P203, C ++ProgramDesign Language, section 10.2.4)
Question 1: a static member has only one copy.
A class generates three instances, but the static members in this class have only one copy in the memory, and they are in the static storage area and are no longer heap or stack. But what if the derived class of this class is used? Are you using the same static member?
Question 2:
What is the difference between global variables and global variables? Is there a limited scope?