Reply-To: "Jorge Ivan Meza Martinez" From: "Jorge Ivan Meza Martinez" To: Subject: RE: the call of the constructor! Date: Fri, 17 Jul 1998 15:39:05 -0500 Message-ID: <01bdb1c2$f0c5ab60$0a1f1bc4@default> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Precedence: bulk Hi, > *always* in the Clase1 constructor is called the empty constructor for k, is > it true? > when I try to write "Clase1 ()" the constructor "Clase2()" for k is > automatically called, |Logic because k is Clase2 and part of Clase1. but look that is always the () constructor, I can't call other constructors. > 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. how to call the constructor that I want instead of the () ? that's why I used ... > 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. sip, but at least it worked ;o). > 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. I don't feel too much safe when I use objects with new, I'd wish to know if exist a way to free the memory of forgotten objects ? I mean, if you create an object with new in a method, if you leave this method with out delete it, the object will remain, now it will be a memory leak and all will fall someday. but, exists something like a garbage collector to dispose this memory of objects that the code never reference again ? that would be useful, but maybe too near to miracle. or at least, a way to see that you are having memory leaks ? jorge ivan meza martinez http://members.xoom.com/THP jimeza AT usa DOT net -----Original Message----- De: Salvador Eduardo Tropea (SET) Para: jimeza AT usa DOT net ; djgpp AT delorie DOT com Fecha: Vi ernes 17 de Julio de 1998 05:14 AM Asunto: Re: the call of the constructor!