C++ Programmer Question: Download Questions PDF
Explain me what is virtual destructors? Why they are used?
![C++ Programmer Interview Answer C++ Programmer Interview Question](https://globalguideline.com/public/images/interview/28.png)
Answer:
Virtual destructors are used for the same purpose as virtual functions. When you remove an object of subclass, which is referenced by a parent class pointer, only destructor of base class will get executed. But if the destructor is defined using virtual keyword, both the destructors [ of parent and sub class ] will get invoked.
Download C++ Programmer Interview Questions And Answers
PDF
Previous Question | Next Question |
Do you know what is an object? | Explain me what is implicit conversion/coercion in c++? |