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

Can we call a virtual function from a constructor?

Answer Posted / hrpynux@gmail.com

You can call a virtual function in a constructor, but be careful. ... In a constructor, the virtual call mechanism is disabled because overriding from derived classes hasn't yet happened. Objects are constructed from the base up, “base before derived”.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is & in c++ function?

1055


Explain function overloading and operator overloading.

1062


What is the use of pointer in c++ with example?

1037


What is the use of oops?

1050


How one would use switch in a program?

1068


What is the difference between struct and class?

1539


Can we specify variable field width in a scanf() format string? If possible how?

1249


Explain shallow copy?

1036


How would you implement a substr() function that extracts a sub string from a given string?

1035


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

1089


State the difference between delete and delete[].

1102


What is new in c++?

1096


Explain the difference between class and struct in c++?

1034


Show the declaration for a pointer to function returning long and taking an integer parameter.

1125


Is map ordered c++?

1089