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...

Explain the need for "Virtual Destructor"?

Answer Posted / lylez00

If A is a base class, and from that, B is derived, and a
dynamically allocated object of type B is deleted via a
pointer of type A, then B's destructor will not be invoked
unless A's destructor is virtual.

A *a = new B();
delete a; // won't invoke B's destructor unless A's
destructor is virtual

Is This Answer Correct ?    12 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain function overloading and operator overloading.

1083


Differentiate between declaration and definition.

1053


What is the keyword auto for?

1043


What is c++ programming language?

1108


Explain virtual class and friend class.

1054


Can you pass an array to a function in c++?

1010


What is prototype for that c string function?

1145


What do you mean by storage classes?

1606


What is a class template?

1087


What language is a dll written in?

1022


What is the importance of mutable keyword?

1024


Is c++ a good first language to learn?

1073


How would you obtain segment and offset addresses from a far address of a memory location?

1086


Does there exist any other function which can be used to convert an integer or a float to a string?

1092


What is the use of data hiding?

1019