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
Who created c++?
What is encapsulation in C++? Give an example.
What is auto type c++?
Describe friend function & its advantages.
What is the difference between a pointer and a link in c ++?
Do the parentheses after the type name make a difference with new?
Which one is a preferred language C or C++? Why?
which of the following is not an secondary constant a) array b) real c) union
What are c++ storage classes?
What is a multimap c++?
What is c++ and its features?
Define whitespace in C++.
Define pointers?
Why can templates only be implemented in the header file?
Define what is constructor?