4
Contributors
4
Replies
24
Views
4 Years
Discussion Span
Last Post by nchy13
1

No there is only ever a single destructor

~a()
{
}

It never takes any parameters. This makes sense, the reason that you have parameterised constructors is that you may wish to initialise your object in several different ways, but when you destroy your object there is no need for any further data, you go from the current state of the object to no-object so the object already knows everything it needs in order to delete itself.

0

Yes, that's how it's supposd to work :)

Why would you not want to do that? When you destroy an object, it's not supposed to be used anymore.

0

it means there will be only one destructor in class to destroy all the objects.......

I would like to point out that a destructor if called by an object destroys that particular instance of object. Each object should call the destructor separately to remove their corresponding instances.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.