Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
10 user(s) are online (10 user(s) are browsing encyclopedia)

Members: 0
Guests: 10

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

Destructor (computer science)

In object-oriented programming, a destructor is a method (computer science) which is automatically invoked when the object (computer science) is destroyed. Its main purpose is to clean up and to free the resource which were acquired by the object along its life cycle and unlink it from other objects or resources. The use of destructors is key to the concept of Resource Acquisition Is Initialization.

In a language with a automatic garbage collection mechanism, it is impossible to deterministically ensure the invocation of a destructor, and hence these languages are unsuitable for Resource Acquisition Is Initialization. In such languages, unlinking an object from existing resources should be done by an explicit call of appropriate function (usually called Dispose). This method is also recommended for freeing resources rather than using Finalizers for that.

=See also=

*Finalizer *Constructor (computer science) *Object lifetime *Resource Acquisition Is Initialization

=References=

  • Bjarne Stroustrup: The C++ Programming Language , Addison-Wesley, ISBN 0-201-70073-5