Hello everyone

I know that one cannot pass a parameter to destructor functions in classes.

Is there a reason why this functionality was left out of c++, and is there a way to get around it?


Sure, just set a member variable before your destructor gets called, and reference that variable from the destructor.



I never thought of that :)

Are you calling your destructor function explicitly? If so.. you probably shouldn't ;)

Well, what I meant was that if I created an object based on a class, with dynamic allocation, such as this:

Vehicle *a = new Vehicle;

then I would have to delete it later on, using delete
I was thinking if there is a way to pass parameters at the delete statement