Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!pdn!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.lang.c++ Subject: Re: Virtual functions used in constructor illegal ! ?? Keywords: virtual functions, constructor Message-ID: <27600443.6496@tct.uucp> Date: 7 Dec 90 21:06:10 GMT References: <39733@ucbvax.BERKELEY.EDU> <27556AD1.350C@tct.uucp> <1990Dec5.014357.17601@relay.wpd.sgi.com> Organization: Teltronics/TCT, Sarasota, FL Lines: 21 A long time ago, someone (okay, it was me) wrote: > If you call a virtual function from a constructor [indirectly], > E&S says that the behavior is undefined, i.e. all bets are off. In response, pal@sgi.com quoted E&S page 294, section 12.7: > Member functions may be called in constructors and destructors. > This implies that virtual functions may be called (DIRECTLY OR > INDIRECTLY [emphasis mine]). The function called will be the one > defined in the constructor's (or destructor's) own class or its > bases, but *not* any function overriding it in a derived class. > [...] > > The effect of calling a PURE [emphasis mine] virtual function > directly or indirectly [...] is undefined. Mea culpa, mea culpa, mea maxima culpa. Pal's quotation is correct, I was wrong, the truth is known, and the world is a better place. -- Chip Salzenberg at Teltronics/TCT , "I'm really sorry I feel this need to insult some people..." -- John F. Haugh II (He thinks HE'S sorry?)