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 / sagarson

Need for a virtual destructor
1.destructor for the base parts are invoked automatically
2.we might delete a ptr to the base type that actually
points to a derived object
3.if we delete a ptr to base then the base class destructor
is run and the members of the base class are cleared up. If
the object is a derived type then the behavior is undefined
4.to ensure that the proper destructor is run the destructor
must be virtual in the base class
5.virtual destructor needed if base pointer that points to a
derived object is ever deleted (even if it doesnt do any work)

Is This Answer Correct ?    34 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is purpose of abstract class?

1070


Can we change the basic meaning of an operator in c++?

1114


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

1110


What is #include ctype h in c++?

1168


What is insertion sorting?

1104


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

2003


What is c++ vb?

1089


what do you mean by volatile variable?

1050


Is recursion allowed in inline functions?

1083


Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).

1109


What is difference between malloc()/free() and new/delete?

1168


What is the difference between a pointer and a link in c ++?

1046


Describe the advantage of an external iterator.

1040


What are smart pointers?

2269


Can comments be nested?

1028