What are virtual Destructors?
By in OOP/OOD on Aug 03 2006
  • Ravi Kumar
    Nov, 2006 14

    "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

    • 0
  • Ravi Kumar
    Nov, 2006 14

    "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

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS