A
asdf
warning: 'class gdt_manager' has virtual functions but non-virtual
destructor
what does this mean? how to fix it?
thanks.
destructor
what does this mean? how to fix it?
thanks.
asdf said:warning: 'class gdt_manager' has virtual functions but non-virtual
destructor
what does this mean? how to fix it?
asdf said:warning: 'class gdt_manager' has virtual functions but non-virtual
destructor
what does this mean?
how to fix it?
海风 said:warnings are not equal to error. you should make destructor virtual.
but not must
destructors should always be virtual functions in order to properly get
invoked.
warnings are not equal to error. you should make destructor virtual.
but not must
Rolf said:Only if the object is destroyed polymorphically.
red said:Yep. On my current project, I'm fighting the "all destructors must be
virtual" directive, on the grounds that we don't actually do any dynamic
allocation, and therefore a virtual destructor is unnecessary.
destructors should always be virtual functions in order to properly get
invoked.
Joe said:[..]
What's the harm in making the destructor virtual?
William said:use virtual to make sure the destructor will be excuted, but it costs a
pointer in vtbl.
Unless you are working under SEVERE memory constraints (e.g. in an embedded
system) this is a non-issue since there is only one vtbl per class with
virtual functions.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.