Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: jimeza AT usa DOT net, djgpp AT delorie DOT com Date: Fri, 17 Jul 1998 17:15:02 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: the call of the constructor! In-reply-to: <01bdb1b1$0651e500$071f1bc4@default> Precedence: bulk "Jorge Ivan Meza Martinez" wrote: [snipped code] > *always* in the Clase1 constructor is called the empty constructor for k, is > it true? I don't have the C++ standard here, but it looks like the natural thing. > when I try to write "Clase1 ()" the constructor "Clase2()" for k is > automatically called, Logic because k is Clase2 and part of Clase1. > but what about if I want to call "Clase2 ( String, > int, ...... );" instead of "Clase2()"; Yes, what about it? what does it change? I think it doesn't have to change anything. Again I don't have the standard but it looks the natural thing because k is just a member of Clase1, nothing more. > in BC you can make "k = "Clase2 > String, int, ...... )" but now I can't with DJGPP. Never trust in BC++ it have a lot of non-portable extentions and normally Borland doesn't put it clear. > remember that in this case I am using objects created with out new. Yes and that's the point, I think you need: class Clase1 { ..... Clase2 *k; } And inside the Clase1 constructor: k=new Clase2(....anything you want...); Instead of expecting some automatic behavior. SET ------------------------------------ 0 -------------------------------- Visit my home page: http://set-soft.home.ml.org/ or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013