when can we use virtual destructor?

Answer Posted / achal ubbott

We should know the proper sequence of calling of
destructors.
1. destructor of derived.
and then
2. destructor of base.

but if base* bptr = new derived();

then
delete bptr;

can behave wrong and violate the sequence. got it?

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How the endl and setw manipulator works?

558


What are guid? Why does com need guids?

570


How do you establish an is-a relationship?

616


What is DlgProc?

596


Is c++ fully object oriented?

551






What is the maximum value of a unsigned char a) 255 b) 256 c) 128

631


What's the order in which the local objects are destructed?

837


Will rust take over c++?

592


How can virtual functions in c++ be implemented?

608


What kind of problems can be solved by a namespace?

591


What is binary search in c++?

568


Can we inherit constructor in c++?

584


What is struct c++?

566


Is c++ a low level language?

511


What is anonymous object in c++?

630