On 1 Mar 2004 at 5:46, Davi de Castro Reis wrote: Date sent: Mon, 01 Mar 2004 05:46:49 -0300 From: Davi de Castro Reis <davicastro@terra.com.br> To: Jerry Feldman <gaf@blu.org> Copies to: suse-programming-e@suse.com Subject: Re: [suse-programming-e] C++:Can one constructor call another from the same object?
Jerry Feldman wrote:
On Fri, 27 Feb 2004 06:55:29 -0500 "Steven T. Hatton" <hattons@globalsymmetry.com> wrote:
In Java it's quite common to call one constructor from another one in the same objects. Can that be done in C++? Is the same kind of situation handled in C++ with default values for arguments to the constructor rather than having two different constructors?
Yes. In general the base class constructor is called implicitly, but you
I think Steven asked if the constructor of the _own_ object can be called inside another constructor. I don't think it is possible. You usually mimic it with defaults values, but I really prefer the Java approach (actually, it is probably the only thing I like in Java).
[]s Davi
This is something that's under serious consideration for adding to the next version of C++ :) ISTR it's called forward constructors. alan -- http://www.ibgames.net/alan Registered Linux user #6822 http://counter.li.org Winding Down - Weekly Tech Newsletter - subscribe at http://www.ibgames.net/alan/winding/mailing.html