[K42-discussion] virtual destructors
Bryan S Rosenburg
rosnbrg at us.ibm.com
Fri Jul 7 06:51:35 EST 2006
We usually just declare the virtual destructor inline in the class
declaration. For example, in class BaseObj (lib/libc/cobj/BaseObj.H) we
have:
virtual ~BaseObj() { /* empty body */ }
I don't know if that will get rid of your mysterious undefined symbol, but
I'd give it a try.
- Bryan
Donour Sizemore <donour at cs.unm.edu>
Sent by: k42-discussion-bounces+rosnbrg=us.ibm.com at ozlabs.org
07/06/2006 04:15 PM
Please respond to
Discussion about K42 <k42-discussion at ozlabs.org>
To
k42discuss <k42-discussion at ozlabs.org>
cc
Subject
[K42-discussion] virtual destructors
C++ requires that classes with virtual methods define a virtual
destructor. Older versions of gcc allow you to get away without it, but
gcc4 enforces it. I'm having trouble adding a destructor to the
VAllocServices class. I want to declare a destructor like this:
VAllocServices{
public:
...
~VAllocServices() = 0;
}
I've read several places that even with a pure virtual destructor, you
need to define a body for it. Such as:
VAllocServices::~VAllocServices() {}
When compiling the above example, a strange symbol is being referenced
(_ZdlPv) but isn't defined and I can't figure out what it is or where it
comes from. It doesn't appear to be a mangled version of anything I
recognize. Does anybody have an idea what could be happening here?
thanks
donour
_______________________________________________
K42-discussion mailing list
K42-discussion at ozlabs.org
https://ozlabs.org/mailman/listinfo/k42-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ozlabs.org/pipermail/k42-discussion/attachments/20060706/d9aa97b0/attachment.htm
More information about the K42-discussion
mailing list