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 are structs in c++?

1 Answers  


WHAT IS THE ABREVATION OF FORTRAN?

4 Answers  


How do I use turbo c++?

1 Answers  


In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?

1 Answers  


How does c++ sort work?

1 Answers  


Can a constructor be private?

1 Answers  


What is an accessor in c++?

1 Answers  


What is a custom exception?

1 Answers  


What is a forward referencing and when should it be used?

1 Answers  


what are prototypes

4 Answers   Infosys, TCS,


In what situations do you have to use initialization list rather than assignment in constructors?

1 Answers  


What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal

1 Answers  


Categories