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
Explain function overloading and operator overloading.
Differentiate between declaration and definition.
What is the keyword auto for?
What is c++ programming language?
Explain virtual class and friend class.
Can you pass an array to a function in c++?
What is prototype for that c string function?
What do you mean by storage classes?
What is a class template?
What language is a dll written in?
What is the importance of mutable keyword?
Is c++ a good first language to learn?
How would you obtain segment and offset addresses from a far address of a memory location?
Does there exist any other function which can be used to convert an integer or a float to a string?
What is the use of data hiding?