Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!ucsd!ucbvax!galileo.berkeley.edu!jbuck From: jbuck@galileo.berkeley.edu (Joe Buck) Newsgroups: comp.lang.c++ Subject: Re: problem with virtual function Message-ID: <38283@ucbvax.BERKELEY.EDU> Date: 20 Aug 90 19:25:59 GMT References: <9008201757.AA23899@sirius.risc.com> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: jbuck@galileo.berkeley.edu (Joe Buck) Lines: 15 In article <9008201757.AA23899@sirius.risc.com>, ckl@SIRIUS.RISC.COM (Carl K. Lim) writes: |> Hello. I have this problem: when I'm calling a virtual function from a parent |> class's constructor, it fails to execute the derived class's function. This is a "feature" and is documented in Ellis and Stroustrup, which is the base document for the C++ standard. Why? Because in the base class constructor, the derived part of the object hasn't been constructed yet; it's in an undefined state. -- Joe Buck jbuck@galileo.berkeley.edu {uunet,ucbvax}!galileo.berkeley.edu!jbuck