Mail Archives: djgpp/2000/02/17/15:18:35
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):xPos(X), yPos(Y),
Length(Len), Width(Wid)
{
}
~Panel()
{
}
};
class Desktop
{
public:
Panel Menu;
Panel Icon;
Desktop():Menu(0, 0, 100, 100), Icon(0, 100, 100, 100)
{
}
};
int main(void)
{
Panel Menu(0, 0, 100, 100);
Desktop foo;
return 0;
}
>
> 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
--
Martin Ambuhl mambuhl AT earthlink DOT net
What one knows is, in youth, of little moment; they know enough who
know how to learn. - Henry Adams
A thick skin is a gift from God. - Konrad Adenauer
__________________________________________________________
Fight spam now!
Get your free anti-spam service: http://www.brightmail.com
- Raw text -