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?
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?
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
Destructor if you are refering to OOP. Deconstructor when talking about World of Warcraft ;-).
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.