Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!nucsrl!tellab5!balr!gill!paul From: paul@gill.UUCP (Paul Nordstrom) Newsgroups: comp.lang.c++ Subject: Re: Constructor question Message-ID: <1278@gill.UUCP> Date: 23 Apr 91 16:14:05 GMT References: <1991Apr2.110623.22219@and.cs.liv.ac.uk> <20164@alice.att.com> <17400@sunquest.UUCP> <20204@alice.att.com> Organization: Gill & Co., L.P., San Francisco Lines: 44 In article <20204@alice.att.com> ark@alice.UUCP () writes: >In article <17400@sunquest.UUCP> francis@sunquest.UUCP (Francis Sullivan) writes: >> ark@alice.att.com (Andrew Koenig) writes: > >> >In article <1991Apr2.110623.22219@and.cs.liv.ac.uk> markr@and.cs.liv.ac.uk writes: > >> >> Can I call one constructor to class X explicitly from within another >> >> constructor to class X ? > >> >No. > >> Yes, by using operator= > >Sorry, but still no. > >The usage you propose is implicitly (not explicitly) calling the constructor >to construct a *different* object. > >The original question was whether it was possible for one constructor >of a class to call another constructor to help it construct the >same object; the answer to that question is `no.' >-- > --Andrew Koenig > ark@europa.att.com I'm sure I'm missing something, but why does the following not imply an affirmative answer to markr's question? X::X() { new (this) X(1); // use some other constructor ... } X::X(int j) { // some other constructor } -- -- Paul Nordstrom Gill & Co., L.P. uunet!gill!paul