Answer Posted / guest
Any class that may act as the base of another class should
have a virtual destructor. This ensures that when an object
of the derived class is destroyed that the derived class
dtor will be invoked to destroy it. If the destructor is not
virtual, under some common circumstances, only the base
class' destructor will be invoked, regardless of the class
actually being destroyed. For practical purposes this means
that a class which does, could or should have virtual member
functions, should also have a virtual destructor.
| Is This Answer Correct ? | 18 Yes | 3 No |
Post New Answer View All Answers
What is an advantage of polymorphism?
Why multiple inheritance is not possible?
What is the difference between abstraction and polymorphism?
What is the difference between a mixin and inheritance?
What is use of overloading?
What is property in oops?
What is pure oop?
What is debug class?what is trace class? What differences are between them? With examples.
What is polymorphism explain its types?
How do you achieve runtime polymorphism?
Why is destructor used?
What is static modifier?
How do you answer polymorphism?
Why do we use class in oops?
Who invented oop?