Newsgroups: comp.lang.c++ Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-picayune.mit.edu!athena.mit.edu!bjaspan From: bjaspan@athena.mit.edu (Barr3y Jaspan) Subject: Re: Constructor question Message-ID: <1991Apr14.184015.9497@athena.mit.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology References: <1991Apr2.110623.22219@and.cs.liv.ac.uk> <20164@alice.att.com> <17400@sunquest.UUCP> <20204@alice.att.com> Date: Sun, 14 Apr 91 18:40:15 GMT Lines: 23 |> > >> 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. Perhaps I don't understand the question (I don't recall the original posting), but this sounds like it applies (from the last annotation in ARM, section 12.1, p. 267 in my copy): "Calling a constructor from within a constructor is allowed, but often what it does isn't what the user expected. [code deleted] Such code is sometimes written by programmers who want to factor out the common parts of a set of constructors ... the way to factor out initialization code is to have an explicit initialization function that is not a constructor." -- Barr3y Jaspan, bjaspan@mit.edu Watchmaker Computing