Why and when is a virtual destructor needed?

Answer Posted / hemlata selokar

At the time of inheritance, when we are deleting the object
of derived class with the help of base class pointer that
time virtual destructors are used... After making base class
destructor as virtual, the derived class destructor is
called first followed by base class destructor...With the
help of this proper sequence is maintained and helps in
proper execution.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why oops is important?

779


hi all..i want to know oops concepts clearly can any1 explain??

1880


What is the main purpose of inheritance law?

929


What is the diamond problem in inheritance?

807


What does sksksk mean in text slang?

1821


which feature are not hold visual basic of oop?

1930


INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?

1874


What is polymorphism and why is it important?

757


What is encapsulation in oops?

749


What is this pointer in oop?

778


What is the difference between a mixin and inheritance?

724


What is overriding in oop?

775


Why is there no multiple inheritance?

759


What is coupling in oops?

814


What is coupling in oop?

767