How do you know that your class needs a virtual destructor?
Answer Posted / guest
If your class has at least one virtual function, you should
make a destructor for this class virtual. This will allow
you to delete a dynamic object through a baller to a base
class object. If the destructor is non-virtual, then wrong
destructor will be invoked during deletion of the dynamic
object.
Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
How does class accomplish data hiding in c++?
What is time_t c++?
Do the parentheses after the type name make a difference with new?
What is doubly linked list in c++?
What is the use of class in c++?
What is #include iomanip?
What is meant by a delegate?
what are function pointers?
What is function prototyping?
What is virtual destructor? What is its use?
What is the size of a vector?
What is pure virtual function?
Explain rethrowing exceptions with an example?
Write about the local class and mention its use?
What is the disadvantage of using a macro?