Research on Singletons

Singletons are a concept I was not overly comfortable with. Singletons are creating a single referenced instance of a class/object to be referenced where needed in a program while avoiding duplicates. This is especially important for things like interfaces, which are used in a system to separate layers to allow for modularity. For instance, a graphics interface singleton would be set up on build to reference what it needs to use (DirectX, OpenGL, etc.) so that every other part of the program only needs to call the singleton to get something done, such as drawing an object.

Implementation wise, however, I’m still a bit rusty. I’ve been looking at different sources (previous course work from my school, msdn, etc.) and it seems straightforward. You make a class, make a static reference to that class which will be the instance, and give a public way for other classes to access it. I have some linker bugs that tend to pop up when I try this, though, as well as issues resolving a private static member.


For reference:

msdn, rastertek

Keywords: fsed3proj, singleton, msdn,, rastertek, graphics, interface

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s