All of lore.kernel.org
 help / color / mirror / Atom feed
* singleton pattern really necessary?
@ 2007-07-22  6:32 Shriramana Sharma
  0 siblings, 0 replies; only message in thread
From: Shriramana Sharma @ 2007-07-22  6:32 UTC (permalink / raw)
  To: Linux C Programming List

I was wondering, if a person wants there to be only one instance of a 
class, they can simply do something like:

class {
<class definition here>
} classInstance ;

which automatically creates a single instance of a class. Why go to the 
extent of locking the constructor, copy constructor, operator= etc? The 
only possible thing (that I can think of) that cannot be done is 
conveniently passing it as an argument to a function. Is there any other 
reason that would make a class-name necessary?

Shriramana Sharma.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-22  6:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-22  6:32 singleton pattern really necessary? Shriramana Sharma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.