|
From: Gregor P. <Gre...@dl...> - 2001-01-25 12:59:09
|
I got a class 'Banner' which owns several constructors, like
Banner::Banner(string oneStr)
{ ... }
Banner::Banner( string 1stStr, string 2ndStr)
{ ... }
Banner::Banner( string 2stStr, string 2ndStr, string 3Str)
{ ... }
and so on ...
From my programm itself I'd like to call them with a unknown number of
parameters
Banner("new!");
Banner( "Hello", "world");
Banner( "C++", "is", "fun");
For a few strings this seems ok but its getting more and more
complicated with lots of strings
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"); )
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 );
Gregor
|