• Advertisement
Sign in to follow this  

Accessing other members, the best method? (wxWidgets)

This topic is 2352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This isn't wxWidgets specific, but it's currently what I'm doing. Here's my issue (that i've run into alot, with general C++ programming).
File1.cpp

class SomeClass
{
public:
int *m_iPointer;
};
exterm SomeClass *myGlobalPointer;


In "File2.cpp" I need to access "m_iPointer" this is how I do it now:

File2.cpp

somefunc()
{
myGlobalPointer->m_iPointer;
}


When coding with any API (sfml/sdl/wxwidgets) I always have a "main/master" class that's exposed to a global object, and I access everything from there.
Is this *okay*? or if there's really no other way, does wxWidgets provide me a better way? I know the event system, but that doesn't help to much.

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement