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
write a program to find 2 power of a 5digit number with out using big int and exponent ?
How many human genes are polymorphic?
What is abstract class in oop?
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
write string class as your own class in java without using any built-in function
What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?
any one please tell me the purpose of operator overloading
What is cohesion in oop?
write a programe to calculate the simple intrest and compund intrest using by function overlading
Is oop better than procedural?
What are different oops concepts?
What is coupling in oop?
Why do we use oops?
What is inheritance and how many types of inheritance?