What is a virtual destructor?

Answer Posted / nakul 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 baller 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

Define pre-condition and post-condition to a member function in c++?

665


Why do we use using namespace std in c++?

601


What is the difference between public and private data members?

664


What is const in c++?

600


What is the return value of the insertion operator?

604






What is the difference between struct and class?

745


What is c++ hiding?

621


What is buffer and example?

525


What is the use of object in c++?

570


What are disadvantages of pointers?

568


Can you Mention some Application of C/C++?

625


How do you initialize a string in c++?

560


What do you mean by global variables?

572


In int main(int argc, char *argv[]) what is argv[0] a) The first argument passed into the program b) The program name c) You can't define main like that

614


Can we use this pointer in a class specific, operator-overloading function for new operator?

613