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
Explain rtti.
Differentiate between a constructor and a destructor in c++.
What is protected inheritance?
Explain the pure virtual functions?
What is the difference between mutex and binary semaphore?
What is this pointer in c++?
What is a class template?
Explain the auto storage classes in c++.
What does floor mean in c++?
What is c++ try block?
Can a class be static in c++?
Define a pointer to a data member of the type pointer to pointer?
Explain the term memory alignment?
What is c++ iterator?
What's the "software peter principleā?