What is a virtual destructor?

Answer Posted / munendra kumar

The simple answer is that a virtual destructor is one that is declared with the virtual attribute.

The behavior of a virtual destructor is what is important. If you destroy an object through a pointer or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be complete.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why iomanip is used in c++?

637


What is the latest c++ version?

607


How can I learn c++ easily?

623


What is setf in c++?

579


How do I run a program in notepad ++?

601






What is the use of 'this' pointer?

768


What is stl containers in c++?

585


What is the difference between a declaration and a definition?

584


What is a local variable?

578


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

601


What are the four partitions in which c++ compiler divides the ram?

700


What do you mean by ‘void’ return type?

606


What is a namespace in c++?

600


What are the various operations performed on stack?

629


What do you mean by inheritance in c++?

606