Hi RRick,
Your explaination is very clear for me to see the advantages of the three solutions in this matter. I will consider about them. Many thanks!
@all: Again, thank you very much for your support. I have learned many valuable experiences from you.
Best regards,
.viettrung.
User Profile
Collapse
-
Hi Ganon11,
Thanks alot for you suggestion. That is a good idea. But in my case, the two classes have no relationship else but sharing the common data list. So logically I do not want them to share the same parent.
Have a good day!
.viettrung.Leave a comment:
-
Hi uofm,
Thanks so much for your solution.
Actually I have thought about this solution before, but one point makes me not totally satisfied is that class A and B seem to be closely coupled to each other. Specifically class B should know about A to get the common data. Do you think so?
By the way, I have just googled for this matter and found out something called Monostate Pattern which, I think, may...Leave a comment:
-
Two classes share common data - How to?
Hi,
I have two classes that share a common data list (specifically, a std::vector). This data list should be accessed by the two classes only, so I think using a global variable is not a good solution. Actually I am so confused to find an elegant way to store such common data for the two.
If you have any idea about that, please let me know.
Thanks alot!
.viettrung.
No activity results to display
Show More
Leave a comment: