Christopher Smith wrote:
What he means (well, not sure if this is what he means, but it *should* be what it means), is if you have any memory in the derived class that is allocated with new()/malloc(), or really any resources that need to be cleaned up in the subclass's destructor.

My understanding of the problem is that if you create a subclass that has member variables, you [new] an instance of that subclass, assign that pointer to a pointer-to-parent, and then [destroy] the parent, you will wind up calling the parent's destructor, which (a) won't clean up child memory and (b) won't necessarily even deallocate all the memory allocated.

Hence, the compiler warning would seem to be "Hey, you've said you've written code I don't know about, and if it uses any memory, you're screwed." Wouldn't it be better to make that an error, really?

It's not like there's anything you can do to *not* make it an error, given that it's code you haven't written yet, and perhaps even code you aren't even the author of.

--
  Darren New / San Diego, CA, USA (PST)
    "That's pretty. Where's that?"
         "It's the Age of Channelwood."
    "We should go there on vacation some time."

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to