delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/17/18:20:21

Message-ID: <38AC7641.5385A627@caresystems.com.au>
Date: Fri, 18 Feb 2000 08:29:21 +1000
From: leon <Leon AT caresystems DOT com DOT au>
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: c++
References: <HEHq4.4290$CC3 DOT 119351 AT wagner DOT videotron DOT net>
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:

initialise contained class (ie Panel) in the CONSTRUCTOR stage of
Dekstop
ie 
INSTEAD of writing
class Desktop{
 public:
  Panel Menu(0,0,100,100);
  Panel Icon(0,100,100,100);
}
write this:
class Desktop{
 public:
  Panel Menu;
  Panel Icon;
}
then in 
Desktop::Desktop()
:
Menu(0,0,100,100),Icon(0,100,100,100)
{
}
have a nice day ;-)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019