|
From: Chris B. <ch...@cb...> - 2001-01-25 19:28:46
|
----- Original Message -----
From: "Gregor Peter" <Gre...@dl...>
To: <dev...@li...>
Sent: 25 January 2001 12:59
Subject: [Dev-C++] array as parameter
> I would prefer a constructor which accept a array of strings
> #define MAX_WORDS 10
> Banner::Banner( string words[MAX_WORDS] )
>
> Is it possible to call this in the above manner?
> (Like: Banner("I", "don't", "know", "what", "to", "write"); )
This will cause you problems because the constructor is expecting string
pointer and you are trying to pass it several character pointers. I.e. you
are sending the wrong type and wrong number of arguents.
> Do I have to create a fully defined array each time just to pass it to
> the constructor?
> string dummy[MAX_WORDS]={"I","don't","know","what","to","do","!","
> "," "," "};
> Banner( dummy );
Unfortunately, I think you are going to have to pass it like you have above.
Hope this helps.
Chris B.
_______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|