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

What is virtual constructors/destructors?

Answer Posted / nk

There is nothing like virtual constructors but we can have
virtual destructors so that the destructor of the correct
object is called.
Ex.

Base *bptr = new derived()

delete bptr; then the destructor of the derived objetc is
called when the base destructor is marked as virtual.

else destructore of base class is called and may lead to
memory leak if we have allocated any new memory.

Is This Answer Correct ?    18 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is polymorphism explain?

1312


Is html an oop?

1123


Why is static class not inherited?

1149


What is new keyword in oops?

1099


Why multiple inheritance is not possible?

1117


Why is oop useful?

1170


What is the highest level of cohesion?

1110


Is react oop?

1107


How Do you Code Composition and Aggregation in C++ ?

25600


What is coupling in oops?

1218


What are the components of marker interface?

1103


Why do pointers exist?

1148


What are the three main types of variables?

1176


What are the benefits of oop?

1342


Why is encapsulation used?

1054