In short: Call for virtual function in constructor is redirected to the
local function because, the derived part of the object has not being
initialized yet(remember you are still in Bases' constructor) and it makes
no sense to call a derived's implementation of a virtual function, which in
turn be using some (still uninitialized) non-static data members of derived
class.

You can read it in detail over here:
http://www.parashift.com/c%2B%2B-faq-lite/calling-virtuals-from-ctors.html

Also i recommend - *Inside the C++ Object Model* By Stanley B. Lippman.

Cheers,

On 10 October 2012 02:16, rahul sharma <rahul23111...@gmail.com> wrote:

> Guys i have read that concept of virtual fxn is not applicable in case of
> constructors..I means using virtual function in constructors always call
> local function..i wan to read more on this..can nybody explain use of
> virtual functions in constructor or provide me with a link for this..
>
> thnx
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to