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

write a programe to calculate the simple intrest and compund intrest using by function overlading

1659


What are the 3 pillars of oop?

607


Is html an oop?

571


How oops is better than procedural?

581


Why oops is important?

599






write a program to find 2^n+1 ?

1540


Why is abstraction used?

599


What are functions in oop?

580


Can an interface inherit a class?

552


Why is polymorphism important in oop?

627


Is abstract thinking intelligence?

586


What is object-oriented programming? Webopedia definition

715


Can main method override?

580


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1409


What is advantage of inheritance?

683