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
Where and why do I have to put the "template" and "typename" keywords?
What is the difference between structure and class?
What is a v-table?
What do manipulators do?
What is the auto keyword good for in c++?
How is static data member similar to a global variable?
What are the various situations where a copy constructor is invoked?
What do you mean by global variables?
What is doubly linked list in c++?
Can member data be public?
Write about the various sections of the executable image?
What is the size of a vector?
What is diamond problem in c++?
If you want to share several functions or variables in several files maitaining the consistency how would you share it?
What is a storage class used in c++?