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
What is the use of "new" operator?
What is the use of setprecision in c++?
What is the advantage of an external iterator.
What is the use of dot in c++?
Define anonymous class.
Is swift faster than c++?
What is the object serialization?
What are the important differences between c++ and java?
Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.
How do you invoke a base member function from a derived class in which you’ve overridden that function?
What is diamond problem in c++?
What is linked list in c++?
Difference between strdup and strcpy?
If dog is a friend of boy and boy is a friend of house, is dog a friend of house?
What is the C-style character string?