Explain the need for "Virtual Destructor"?
Answer Posted / lylez00
If A is a base class, and from that, B is derived, and a
dynamically allocated object of type B is deleted via a
pointer of type A, then B's destructor will not be invoked
unless A's destructor is virtual.
A *a = new B();
delete a; // won't invoke B's destructor unless A's
destructor is virtual
| Is This Answer Correct ? | 12 Yes | 3 No |
Post New Answer View All Answers
What jobs can you get with a c++ certification?
What does floor mean in c++?
Briefly describe a B+ tree. What is bulk loading in it?
What are the benefits of operator overloading?
What is setf in c++?
How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?
What is a volatile variable in c++?
What is the difference between function overloading and operator overloading?
What is the difference between the functions memmove() and memcpy()?
What are the four partitions in which c++ compiler divides the ram?
What are the uses of static class data?
what is VOID?
What do c++ programmers do?
What is data types c++?
What is the full form of c++?