View Full Version : w00t singletons
Just thought I'd mention that I've written and am using my first Singleton class in C++. Pretty Cool. :)
recluse
03-23-2002, 02:04 PM
zzzzooooooooooooomm
*recluse wonders what just zipped over his head.
well, assuming you understand object oriented programming ->
Imagine a situation where you may only ever want one instance of something. Examples of "real life" singleton objects are file-systems, and print-spoolers. You only have ever have one of those at a time on your computer, right? Well, in your program you may have a similar situation... often some kind of manager of some sort. So you use the "Singleton" design pattern to create your class for that object. (A design pattern is a pattern, kind of like a template, that can be used in many different situations)
recluse
03-23-2002, 06:19 PM
I'm working on my understanding of OOP as we speak.
Ok I have a genral understanding of what you're talking about now.
By the way templates are cool. OOP will be cooler once I become more proficient in that area.
Templates are very cool. I didn't mean to connect patterns to c++ templates, though. I was speaking in the general sense of a templace. Now that I think of it, though, in a way, they are connected; they're both for techniques for fitting a single solution to multiple problems, except that a design pattern is an abstract concept and a template is an actual c++ construct.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.