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

In c++ there is only virtual destructors, no constructors. Why?

Answer Posted / subhashish sen

Constructor can not be virtual...The main reason is when we
have a virtual function in a class the VTABLE for that
function will be created..which contains the address of the
virtual function...means for each class which contains a
virtual function a VTABLE will be created and constructor is
an entity which initializes this VTABLE.So if you declare
constructor as virtual who will initialize VTABLE for it.

Destructors can be virtual because virtual destructor
ensures proper calling order of all destructors in a class
hierarchy.

If you need further clarification reply me....

Is This Answer Correct ?    28 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where You Can Use Interface in your Project

1877


write a program to find 2 power of a 5digit number with out using big int and exponent ?

2355


What is pure oop?

1080


what is different between oops and c++

2520


I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...

2096


What is static modifier?

1195


What is solid in oops?

1107


When not to use object oriented programming?

1077


What is data binding in oops?

1070


Templates mean

2061


What is abstraction example?

1083


How do you explain polymorphism?

1059


How do you achieve runtime polymorphism?

1036


What are the types of abstraction?

1056


Can an interface inherit a class?

1046