CodePudding user response:
A * pA - & gt; varCodePudding user response:
I am in A class defines the need to collect the global variables, and then in the process of class B data acquisition, in B class defines A, A. In class C also defines A, A, want to display the collected data, the results showed that the A and B type A is not the same variable in C, using pointer if is the questionCodePudding user response:
"Five global variables defined in A class", why must want to be in A class definition global variables, create A X.h (extern defined global variables) and PP X.C (global variables), then A, B, C, respectively, import the X.h file not to go, why botherCodePudding user response:
Well done directly with static variablesCodePudding user response:
Static variables can only be used in a file, not across multiple filesCodePudding user response: