A object generated classes such as class A, B, and class B generated in the class C, D, E,
Want to call the class A method in the class E, or notify A
So there are several kinds of method? These classes are not window
CodePudding user response:
The easy way is A class defines A message and A corresponding message processing function, and other places need to transfer data to A direct when you send A message
CodePudding user response:
reference 1st floor lx624909677 response: the easy way is A class defines A message and A corresponding message processing function, and other places need to transfer data to A direct send A message over things SendMessage? If these classes are in the DLL, send a message handler is not depends on the window? CodePudding user response:
By generating object, the constructor parameters passed in the corresponding object, so passed CodePudding user response:
reference oyljerry reply: 3/f by generating object, the constructor argument passed in the corresponding object, so on the This is a way CodePudding user response:
Use of global variables CodePudding user response:
refer to the second floor candy04502 response: Quote: refer to 1st floor lx624909677 response: The easy way is A class defines A message and A corresponding message processing function, and other places need to transfer data to A direct send A message over things SendMessage? If these classes are in the DLL, send a message handler is not depends on the window? If just call one of A method, can make A friend, if must get A generated class object is the most, then use function parameters CodePudding user response:
A method of A class as static CodePudding user response:
In class E want to invoke the method of class A, class E to get A pointer to the class A object, then calls the class A member function, E how to get A pointer, which can be through the constructor or class member functions E passed in, also can save A pointer to A global variable or class static members, A low coupling approach is to use the function/bind, class E to get the class A object after the bind the fuction of object, make calls again, can be lifted and dependence between class A and class E correlation,