2
Reply

What are virtual Destructors?

Aug 03, 2006
12.1k
0

    "A destructor is a member function of a class, which gets called when the object goes out of scope". This means all clean ups and final steps of class destruction are to be done in destructor. A virtual function is something which helps a derived class in overriding the implementation of a functionality of a base class. The order of execution of destructor in an inherited class during a clean up is like this. 1. Derived class destructor 2. Base class destructor There is one more point to be noted regarding virtual destructor. We can't declare pure virtual destructor. Even if a virtual destructor is declared as pure, it will have to implement an empty body (at least) for the destructor

    Ravi Kumar
    November 14, 2006
    0

    "A destructor is a member function of a class, which gets called when the object goes out of scope". This means all clean ups and final steps of class destruction are to be done in destructor. A virtual function is something which helps a derived class in overriding the implementation of a functionality of a base class. The order of execution of destructor in an inherited class during a clean up is like this. 1. Derived class destructor 2. Base class destructor There is one more point to be noted regarding virtual destructor. We can't declare pure virtual destructor. Even if a virtual destructor is declared as pure, it will have to implement an empty body (at least) for the destructor

    Ravi Kumar
    November 14, 2006
    0