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

Why and when is a virtual destructor needed?

Answer Posted / guest

Any class that may act as the base of another class should
have a virtual destructor. This ensures that when an object
of the derived class is destroyed that the derived class
dtor will be invoked to destroy it. If the destructor is not
virtual, under some common circumstances, only the base
class' destructor will be invoked, regardless of the class
actually being destroyed. For practical purposes this means
that a class which does, could or should have virtual member
functions, should also have a virtual destructor.

Is This Answer Correct ?    18 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what's the basic's in dot net

2188


write a program to find 2^n+1 ?

2072


Can static class have constructor?

1037


Is oop better than procedural?

1041


What is ambiguity in inheritance?

1121


What is an advantage of polymorphism?

1097


Get me a number puzzle game-program

2253


What is destructor oops?

1099


when to use 'mutable' keyword and when to use 'const cast' in c++

2165


write a programe to calculate the simple intrest and compund intrest using by function overlading

2207


What makes a language oop?

1068


Please send ford technologies placement paper 2 my mail id

2103


write a C++ program for booking using constructor and destructor.

2546


What are the 4 pillars of oop?

1151


What is object and example?

1179