469,898 Members | 1,832 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

what are static destructors? disadvantages? .. TIA


Jul 22 '05 #1
2 6579
<so*****@somedomain.net> 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
Jul 22 '05 #2
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"
<v.********@comAcast.net> wrote:
<so*****@somedomain.net> 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


Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Adam H. Peterson | last post: by
reply views Thread by Joanna Carter \(TeamB\) | last post: by
12 posts views Thread by Joe Narissi | last post: by
24 posts views Thread by kalamantina | last post: by
669 posts views Thread by Xah Lee | last post: by
4 posts views Thread by Morgan Cheng | last post: by
3 posts views Thread by donna.lenharth | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.