Jump to content
  • Advertisement
Sign in to follow this  
hahaha

c++ Struct Question

This topic is 4122 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

Advertisement
Yes, it's possible.

struct TheStruct
{
static TheStruct & Instance()
{
static TheStruct instance;
return instance;
}

private:
TheStruct();
TheStruct(const TheStruct &);
};


There's a very high probability that doing this is useless (i.e. you don't need the protection), and a high probability that your design will cause you great pain in a few weeks or months.

Share this post


Link to post
Share on other sites
A singleton or similarly a monostate.

*A monostate allows multiple instances but all instances share the same state.

[edit]

You could probably avoid both however.

[Edited by - fpsgamer on August 5, 2007 10:19:27 AM]

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!