[try Beta version]
Not logged in

 
inheritance dtor

Jan 1, 2013 at 6:46am
I have a inheritence as follows
a:b:c

I also have a list of type c

All classes have copy.ctors

In the main program after a few inserts and.a call to print everything is fine
However a.breakpoint within.the dtor reveals that none of the data members of the objects within the list
have been not been copied
Any ideas
Last edited on Jan 1, 2013 at 6:46am
Jan 1, 2013 at 8:44am
closed account (o3hC5Di1)
Hi there,

It's a bit hard to comment on this without seeing your code (for instance, destructor could mean either the destructor of a, b, or c in this case), but I'm going to take a wild guess and ask if you made the destructors of the parent classes virtual?

http://www.parashift.com/c++-faq-lite/virtual-dtors.html

I'm also slightly confused why you are checking in the destructor if any data was copied. The destructor, as its name implies, is where members get destroyed.

Please feel free to rephrase the problem and / or provide some extra information if the above didn't help.

All the best,
NwN
Topic archived. No new replies allowed.