Answer Posted / suresh.k (portblair)
Using virtual destructors, you can destroy objects without
knowing their type - the correct destructor for the object
is invoked using the virtual function mechanism. Note that
destructors can also be declared as pure virtual functions
for abstract classes.
if someone will derive from your class, and if someone will
say "new Derived", where "Derived" is derived from your
class, and if someone will say delete p, where the actual
object's type is "Derived" but the pointer p's type is your
class.
| Is This Answer Correct ? | 2 Yes | 4 No |
Post New Answer View All Answers
What is ambiguity in inheritance?
What does sksksk mean in text slang?
What is encapsulation in simple terms?
Why is there no multiple inheritance?
What are the 4 main oop principles?
#include
How to call a non virtual function in the derived class by using base class pointer
What is encapsulation and abstraction? How are they implemented in C++?
What does <> mean pseudocode?
What is the diamond problem in inheritance?
What is polymorphism what is it for and how is it used?
Can you inherit a private class?
Why is destructor used?
What is encapsulation in oops?
What are functions in oop?