What is virtual destructors? Why they are used?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

what is data encapsulation in C++?

608


What is guard code in c++?

644


What is c++ course?

586


How can I disable the "echo" feature?

611


How can an improvement in the quality of software be done by try/catch/throw?

594






Is eclipse good for c++?

542


What is an incomplete type in c++?

771


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

625


Describe linked list using C++ with an example.

651


What is the full form of dos?

570


What is object file? How can you access object file?

601


A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

3244


How the keyword struct is different from the keyword class in c++?

587


What is the difference between the parameter to a template and the parameter to a function?

641


What are the data types in c++?

523