what are static destructors? disadvantages? .. TIA

Discussion in 'C++' started by someone@somedomain.net, Aug 17, 2004.

  1. Guest

    , Aug 17, 2004
    #1
    1. Advertising

  2. <> wrote...
    >


    IIUIC, a "static destructor" is a static member function of the class
    that accepts one argument - a pointer to the object of that class to
    be destroyed. It is probably used along with "a factory method", when
    there is a need to restrict the creation of instances of some class to
    free store only and/or perform additional steps before or after
    creation of an object. Similar steps may need to be taken before
    and/or after destroying an instance. That's that the "static
    destructor" is for. I don't think it is proper to use those words
    without double quotes since there is no real destructor that is static,
    it's only a pretend destructor.

    Disadvantages? Compared to what? To a non-static (real) destructor?
    Hmm... I am looking for a good analogy here... What are the
    disadvantages of a sorted collection versus non-sorted one? Can you
    answer that question? Every idiom has its application. Advantages or
    disadvantages, you often just have to use a certain idiom. I guess I
    am simply trying to avoid answering that question. I really just
    don't see it as valid.

    V
    Victor Bazarov, Aug 18, 2004
    #2
    1. Advertising

  3. Guest

    Victor,

    Thanks for your reply. I am a newbie, so was curious at the very
    notion of "static destructor". Thanks again.

    cheer.
    K.

    On Wed, 18 Aug 2004 00:55:35 GMT, "Victor Bazarov"
    <> wrote:

    ><> wrote...
    >>

    >
    >IIUIC, a "static destructor" is a static member function of the class
    >that accepts one argument - a pointer to the object of that class to
    >be destroyed. It is probably used along with "a factory method", when
    >there is a need to restrict the creation of instances of some class to
    >free store only and/or perform additional steps before or after
    >creation of an object. Similar steps may need to be taken before
    >and/or after destroying an instance. That's that the "static
    >destructor" is for. I don't think it is proper to use those words
    >without double quotes since there is no real destructor that is static,
    >it's only a pretend destructor.
    >
    >Disadvantages? Compared to what? To a non-static (real) destructor?
    >Hmm... I am looking for a good analogy here... What are the
    >disadvantages of a sorted collection versus non-sorted one? Can you
    >answer that question? Every idiom has its application. Advantages or
    >disadvantages, you often just have to use a certain idiom. I guess I
    >am simply trying to avoid answering that question. I really just
    >don't see it as valid.
    >
    >V
    >
    , Aug 18, 2004
    #3
    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. Steve
    Replies:
    3
    Views:
    478
    Roedy Green
    Dec 13, 2005
  2. eslacker

    Need Schema help, pls. TIA!!!

    eslacker, Aug 7, 2003, in forum: XML
    Replies:
    0
    Views:
    345
    eslacker
    Aug 7, 2003
  3. gorda
    Replies:
    5
    Views:
    5,026
    akhyls
    Mar 7, 2010
  4. Jimmy Cracker

    Environment Variable - Parent Process --- TIA

    Jimmy Cracker, Feb 5, 2005, in forum: C Programming
    Replies:
    12
    Views:
    598
    Keith Thompson
    Feb 7, 2005
  5. Jed
    Replies:
    28
    Views:
    652
    Michael O'Keeffe
    Oct 16, 2005
Loading...

Share This Page