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 a static element?
How does c++ structure differ from c++ class?
Explain virtual class?
What ANSI C++ function clears the screen a) clrscr() b) clear() c) Its not defined by the ANSI C++ standard
What do you mean by static variables?
Does c++ have arraylist?
What is the best way to declare and define global variables?
Why is swift so fast?
What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero
What causes a runtime error c++?
When is the copy constructor called?
How to tokenize a string in c++?
What is c++ good for?
What is the basic structure of c++ program?
What are dynamic type checking?