Re: Private Static member object of the same class
On Jun 7, 6:41 pm, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
VSP wrote:
I am just implementing singleton pattern in various ways. In one
implementation I created a static member and returning that static
member in the getInstance() function. I have made constructor as
private and destructor as public.
Why do you need a public destructor?
Because he's using VC++ 6.0, and that compiler dates to before
the standard. Before the standard, the context in which access
control was applied to the destructor wasn't that clear, and
although it would seem to me that it should be as if in a member
here, most, if not all, compilers back then implemented it as if
the destructor were called at global scope (probably taking the
lead from CFront).
Which "explains" a lot:-).
Try getting a better compiler. Download their Express 2005, it's
so much better, you won't believe it.
It's also free:-).
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34