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
Difference between class and structure.
What are disadvantages of pointers?
Who invented turbo c++?
What is a class definition?
Explain the scope of resolution operator.
Are strings immutable in c++?
What is difference between class and function?
Differentiate between an inspector and a mutator ?
What are the effects after calling the delete this operator ?
Name the operators that cannot be overloaded in C++?
Why is c++ is better than c?
What is an adjust field format flag?
When do we run a shell in the unix system? How will you tell which shell you are running?
What are shallow and deep copies?
What is the benefit of c++?