I'm getting this warning:
class 'xxx' has virtual functions but non-virtual destructor
This warning is correct, but what does it really mean? What are the
gotchas to having a class with virtual functions and a non-virtual
destructor?
Scott Meyers, Bjarne Stroustrup, et. al. have provided much better
explanations in their various tomes, but simply, if you don't use a
virtual destructor, you can't be sure that your base object gets
properly destroyed. f or instance:
class a {};
class b : a {};
a* pa = new b;
delete a; // if a::~a isn't virtual, b::~b won't be called.
Suffice to say, you should always have a virtual destructor; and I
believe that C++200x (i.e., the next version of the C++ standard) will
specify this as a default.
--Matthew Peltzer
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.