What is a virtual destructor?

Answers were Sorted based on User's Feedback



What is a virtual destructor?..

Answer / 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

What is a virtual destructor?..

Answer / 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

More C++ General Interview Questions

What size is allocated to the union variable?

0 Answers  


What is the best it certification?

0 Answers  


What is namespace std; and what is consists of?

0 Answers  


Can you please explain the difference between using macro and inline functions?

0 Answers  


What is a c++ object?

0 Answers  






What are the weaknesses of C++?

1 Answers  


How to stop conversions among objects?

5 Answers   Symphony,


What is a 'pure' virtual function and what's its use?

1 Answers  


What will happen if a pointer is deleted twice?

0 Answers   Agilent, HAL,


Is dev c++ a good compiler?

0 Answers  


Explain the need for "Virtual Destructor"?

2 Answers   Infosys,


What is the use of endl in c++ give an example?

0 Answers  


Categories