Message-ID: From: Nigel Atkinson To: "'djgpp AT delorie DOT com'" Subject: RE: c++ Date: Fri, 18 Feb 2000 08:33:34 +1300 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Reply-To: djgpp AT delorie DOT com Here is a solution, I think there is a better way, but this will work. Define another contstuctor for Panel that dose nothing. Panel() { return } You now can in Desktop write... class Desktop{ public: Panel Menu; Panel Icon; } without any errors. Now add a contstuctor to desktop like.... Desktop() { Menu.Panel( 0, 0, 100, 100 ); Icon.Panel( 0, 100, 100, 100 ); return; } Like I said there is a better way - (which has escaped me at present) - but this should get you going. Nigel Atkinson -----Original Message----- From: Jean-Francois Desjardins [mailto:jfd50 AT videotron DOT ca] Sent: Thursday, 17 February 2000 13:54 To: djgpp AT delorie DOT com Subject: c++ 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); } that way, it give me an ANSI c++ error. I know if I do int main(void){ Panel Menu(0,0,100,100); return(0); } without the Desktop class it will work, but I can't do that... I need the desktop class. Can anyone help please? thanks