Home > Software engineering >  MFC value transfer problem
MFC value transfer problem

Time:10-23

Five global variables defined in A class, the class B in real-time to the five variable assignment, real-time display the five variables in the C value, how to do

CodePudding user response:

A * pA - & gt; var

CodePudding 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 question

CodePudding 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 bother

CodePudding user response:

Well done directly with static variables

CodePudding user response:

Static variables can only be used in a file, not across multiple files

CodePudding user response:

reference cvbtvbwu reply: 3/f
"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 does not have to do is, why bother?

My side is A class A, h and A. CPP, and call A.h class B and class C, and then in the process of class B to class A variable assignment, then C with display function, so I'm in class B 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 C in the class is not the same variable, A displayed value has been 0
  • Related