Answer Posted / kamil mohamed
virtual destructor is recommended when you want to destroy
(delete) an object through it's parent pointer. This good
habit enforces proper cleanup of derived classes
Example:
class Employee {
virtual ~Employee() {}
};
class Manager : public Employee {
~Manager() {}
}
Manager * m = new Employee();
delete m; // <--
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Can an interface inherit a class?
What is oops and why we use oops?
What makes a language oop?
What is the main feature of oop?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
What is an example of genetic polymorphism?
Can we create object of abstract class?
What is difference between oop and pop?
Why do while loop is used?
What are the data types in oop?
What is class and object in oops?
What is polymorphism programming?
Describe these concepts: Polymorphism, Inheritance and Abstraction.
What is byval and byref? What are differences between them?
What exactly is polymorphism?