Path: utzoo!attcan!uunet!lll-winken!lll-tis!mordor!joyce!ames!mailrus!nrl-cmf!cmcl2!rutgers!att!ihlpa!vkar From: vkar@ihlpa.ATT.COM (Thayalan) Newsgroups: comp.lang.c++ Subject: Re: Default initializations for class constructors Summary: Zortech C++ compiler handles this correct. Keywords: c++ Message-ID: <9370@ihlpa.ATT.COM> Date: 12 Sep 88 18:39:55 GMT References: <684@paris.ICS.UCI.EDU> <8184@alice.UUCP> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 29 In article <8184@alice.UUCP>, bs@alice.UUCP (Bjarne Stroustrup) writes: > > > bonnie.ics.uci.edu > University of California, Irvine - Dept. of ICS) > > > Hi, > > > Can someone please enlighten me as to the correct behavior of C++ > > when class constructors with different argument types are all declared > > to have default parameter initializers? My basic question is, which > > of the constructors should be selected if the type is not clear from > > the definition of a class object? G++ appears to use the first > > lexically presented constructor as the default, is this specified, or > > is the behavior undefined in the language? > > No, the implicit call of (some) foo::foo() from bar::bar() is ambiguous > and therefore clearly an error. Cfront gets it wrong too, though. Sorry. > > - Bjarne The Zortech C++ compiler on my PC handles this correctly. It gives a error, stating that it cannot resolve which constructor for the class foo to use in the derived class bar. k. Thayalan