tags:

views:

109

answers:

3

In my daily life and while reading books I've seen the term destructor as well as deconstructor.

But what is the correct name for this method?

+5  A: 

It is destructor used to cleanup the stuff when the object is about to die. It is called automatically if specified when object is going to be removed/die.

More Info:

http://en.wikipedia.org/wiki/Destructor_%28computer_science%29

Sarfraz
http://en.wikipedia.org/wiki/Destructor_%28computer_science%29
Leniel Macaferi
@Leniel Macaferi: Yup thanks for adding that :)
Sarfraz
+2  A: 

Destructor if you are refering to OOP. Deconstructor when talking about World of Warcraft ;-).

Ralph
+2  A: 

Destructor is the most common term (deconstructor sounds like local usage: I like it in a way, since it points out a symmetry with constructors).

But these things are to some extent language-specific, since different OO languagers have different models for the lifecycle of instances. Take C#, for instance, where instead of destructors you have finalizers, which have weak execution guarantees, supplemented by the language-supported Dispose() pattern which provides determinacy.

Pontus Gagge