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
What are shallow and deep copies?
Explain the difference between static and dynamic binding of functions?
Why can templates only be implemented in the header file?
What does override mean in c++?
In the derived class, which data member of the base class are visible?
What is the best c++ compiler for windows 10?
What is capacity in vector in c++?
How do you save a c++ program?
Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?
What do you know about near, far and huge pointer?
What is the latest c++ standard?
Differentiate between a constructor and a method in C++.
What is fixed in c++?
How would perform Pattern Matching in C++?
Why is c++ difficult?