Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!aplcen!uunet!tcs!nujoizey!gwu From: gwu@nujoizey.tcs.com (George Wu) Newsgroups: comp.lang.c++ Subject: Re: problem with virtual function Keywords: constructor virtual table Message-ID: <970@tcs.tcs.com> Date: 22 Aug 90 00:24:46 GMT References: <9008201757.AA23899@sirius.risc.com> Sender: usenet@tcs.com Reply-To: gwu@nujoizey.tcs.com (George Wu) Organization: Teknekron Communications Systems Lines: 17 This question has been asked before. According to Stanley Lippman's "C++ Primer," virtual functions called from the constructor or destructor of a base class will call the virtual function defined in the base class. This is by definition of the C++ language. The explanation is that at construction time, the derived object will not yet be constructed, so the function cannot be from the derived class. Likewise, in the destructor, the derived class will have already been destroyed. George ---- George J Wu | gwu@tcs.com or ucbcad!tcs!gwu Software Engineer | 2121 Allston Way, Berkeley, CA, 94704 Teknekron Communications Systems, Inc.| (415) 649-3752