Advertisement Jump to content
Sign in to follow this  
TrevorJanok

Accessing other members, the best method? (wxWidgets)

This topic is 2681 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!