0

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?

Thanks!

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by tundra010
0

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

Dave

0

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

Edited by tundra010: n/a

This question has already been answered. 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.