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 are function prototypes?
what do you mean by volatile variable?
Explain mutable storage class specifier.
Why #include is used?
Explain how to initialize a const data member.
Explain the volatile and mutable keywords.
How would you use the functions randomize() and random()?
What is #include c++?
Will a catch statement catch a derived exception if it is looking for the base class?
What is a lambda function c++?
What is constant in c++ with example?
What are pointers used for c++?
What is overloading unary operator?
Explain the differences between list x; & list x();.
Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).