What is virtual destructors? Why they are used?



What is virtual destructors? Why they are used?..

Answer / hrpynux@gmail.com

Virtual destructors in C++ are used to avoid memory leaks especially when your class contains unmanaged code, i.e., contains pointers or object handles to files, databases or other external objects. A destructor can be virtual. ... Now, suppose you create an instance of the Derived class using a Base class pointer.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Does a derived class inherit or doesn't inherit?

0 Answers  


What is an arraylist c++?

0 Answers  


What is the difference between global variables and local variable

0 Answers  


What is encapsulation in c++?

0 Answers  


Explain the difference between 'operator new' and the 'new' operator?

1 Answers   Lucent, TCS,






Give 10 points of differences between C & C++.

0 Answers   HCL,


When does the c++ compiler create temporary variables?

0 Answers  


Disadvantages of c++

8 Answers   HCL,


What is a namespace in c++?

0 Answers  


What is nested class in c++?

0 Answers  


What is boyce codd normal form in c++?

0 Answers  


What is a v-table?

0 Answers  


Categories