Hi,
I have a complex C++ code with gui. Each major gui division is independent class. Now these classes must 'talk' sometimes in operations like copy from division A and paste in division B. So I need to pass some pointers from one class to another.
I was thinking of using friend methods but I see that I have to pass object each time I call the function which complicates stuffs.
I thought then of static function but then, my pointers will have to be static and I see it will complicate stuffs. I decided to ask if anyone have met this challenge of inter class communication and how to resolve it!
Thanks a lot

Recommended Answers

All 4 Replies

Why not public (or protected, if the classes are related) getter/setter functions? If that doesn't make sense then I'm not entirely sure what your problem is, in that case... could you elaborate with an example?

Getters/Setters in Each class?
I was trying to avoid that!

Is that worse than friend or static functions in each class? I guess I'm missing something about your problem

Is that worse than friend or static functions in each class? I guess I'm missing something about your problem

Ok let me weigh the consequence of both approach again and I will go to simplest!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.