Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

when can we use virtual destructor?

Answer Posted / n

Virtual Destructor is a concept, comes into picture when one
will try to delete the base object pointer pointing to
derived class.
Base* pb = new Derived();
delete pb;
In this case if Base class destructor is not virtual then
only base class destructor will be called up for clean up.

While if we make Base class destructor as virtual then
1. Derived class destructor will be called
2. Base class destructor will be called up

Proper clean up of the objects from derived as well as base
class. Mission Accomplish

Is This Answer Correct ?    36 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Reverse the Linked List. Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL

812


What is a Default constructor?

1603


What is a v-table?

1185


What is an adaptor class or wrapper class in c++?

1239


What is the average salary of a c++ programmer?

1023


Explain explicit container.

1092


What are references in c++? What is a local reference?

1047


Why was c++ created?

1031


Can I learn c++ as my first language?

1113


What is the best free c++ compiler for windows?

1112


What is srand c++?

1116


State two differences between C and C++.

1176


What is the difference between an enumeration and a set of pre-processor # defines?

1393


How is c++ different from java?

1050


How does atoi function work?

1157