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

What is a flag in c++?

1057


Which field is used in c++?

1107


explain the reference variable in c++?

1063


What is meaning of in c++?

1211


Can we make copy constructor private in c++?

1052


How do you declare A pointer to a function which receives nothing and returns nothing

1235


What does ctime() do?

1125


Write a Program for find and replace a character in a string.

1080


What is the type of 'this' pointer?

1016


What is the use of "new" operator?

1130


Name four predefined macros.

1040


Why c++ is not a pure oop language?

1040


How do you traverse a btree in backward in-order?

1033


What is dev c++ used for?

1035


Discussion on error handling of C++ .

1120