Sender: root AT delorie DOT com Message-ID: <38AC37FE.711B4F07@inti.gov.ar> Date: Thu, 17 Feb 2000 15:03:42 -0300 From: salvador Organization: INTI X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.38 i686) X-Accept-Language: es-AR, en, es MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: c++ References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Jean-Francois Desjardins wrote: > Hello! > I want to know how I can initialize an object, within an object: > ex: > > class Panel{ > private: > char xPos; > char yPos; > char Length; > char Width; > public: > Panel( char X, char Y, char Len, char Wid); > ~Panel(); > }; > > Panel( char X, char Y, char Len, char Wid);{ > xPos=X; > yPos=Y; > Length=Len; > Width = Wid; > } > > class Desktop{ > public: > Panel Menu(0,0,100,100); > Panel Icon(0,100,100,100); > } What about: class Desktop{ public: Panel *menu; Panel *icon; Desktop(); ~Desktop(); } Desktop::Desktop() { menu=new Panel(0,0,100,100); icon=new Panel(0,100,100,100); } Desktop::~Desktop() { delete menu; delete icon; } It have some advantages. SET -- Salvador Eduardo Tropea (SET). (Electronics Engineer) Visit my home page: http://welcome.to/SetSoft or http://www.geocities.com/SiliconValley/Vista/6552/ Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org set AT ieee DOT org set-soft AT bigfoot DOT com Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013