It can be used to limit the number of instances of a singleton class to be created. For example “your” singleton class can has only one instance, “my” singleton class can has a fixed number of instances.

old (HH)
class Singleton {
/* Other public members will be added here */

/* Other private members will be added here */
static Singleton obj[3];

2001-7-16 -04:00

回到话题: Can I write constructer as private in c++, if I can who can access it ? (This my interview question, continue)

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论