Re: a question about singleton/private destructor

Discussion in 'C++' started by Evan, Jul 6, 2003.

  1. Evan

    Evan Guest

    "jack" <> wrote in message news:<be2tdl$o87$>...
    > The following code is from Thinking in C++.
    >
    > Q1:
    > If I declare a private destructor then it
    > won't compile (I'm using Microsoft visual c++ 6.0).
    > But I read somewhere that destructors can
    > be private in a singleton. What's going on?


    (Background) There was a thread on singletons just a little while ago.
    I gave an option for the implementation one where Instance() returned
    a pointer and the class had a private destructor.

    Anyway, someone replied that VC++6 flags a private dtor as an error
    and won't compile. Anyway, it's a compiler bug.
     
    Evan, Jul 6, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jack
    Replies:
    0
    Views:
    364
  2. frs
    Replies:
    20
    Views:
    759
    Alf P. Steinbach
    Sep 21, 2005
  3. arun
    Replies:
    2
    Views:
    547
    benben
    Jun 13, 2006
  4. Jimmy Hartzell
    Replies:
    0
    Views:
    421
    Jimmy Hartzell
    May 19, 2008
  5. Jimmy Hartzell
    Replies:
    2
    Views:
    1,171
    Jimmy Hartzell
    May 20, 2008
Loading...

Share This Page