Connecting Tech Pros Worldwide Help | Site Map

what are static destructors? disadvantages? .. TIA

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 22nd, 2005, 05:59 PM
someone@somedomain.net
Guest
 
Posts: n/a
Default what are static destructors? disadvantages? .. TIA



  #2  
Old July 22nd, 2005, 05:59 PM
Victor Bazarov
Guest
 
Posts: n/a
Default Re: what are static destructors? disadvantages? .. TIA

<someone@somedomain.net> wrote...[color=blue]
>[/color]

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


  #3  
Old July 22nd, 2005, 05:59 PM
someone@somedomain.net
Guest
 
Posts: n/a
Default Re: what are static destructors? disadvantages? .. TIA

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.Abazarov@comAcast.net> wrote:
[color=blue]
><someone@somedomain.net> wrote...[color=green]
>>[/color]
>
>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
>[/color]

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.