A
anti-guru
This is killing me. How can I make a static array of two strings in my
class?
Nothing I've tried works. Here is what I currently have, which also doesn't
work, but gives the least amount of compiler errors:
in my header file:
private:
static char *stringTable[ 2 ];
in my class source file:
*stringTable[ 0 ] = new char[ strlen( "myString" )];
This particular attempt says "cannot convert from 'char *' to 'char'
Ideally, I would like to use curly brackets to initialize everything at
once. I've tried to do that in the header, but I've learned that it doesn't
allow that.
I've consulted my Deitel book, and my c++ primer, but I can't seem to put
the pieces together.
If it's not too much to ask, could you please not use any STL if you reply;
I'm barely treading water with the regular language.
Thanks!
class?
Nothing I've tried works. Here is what I currently have, which also doesn't
work, but gives the least amount of compiler errors:
in my header file:
private:
static char *stringTable[ 2 ];
in my class source file:
*stringTable[ 0 ] = new char[ strlen( "myString" )];
This particular attempt says "cannot convert from 'char *' to 'char'
Ideally, I would like to use curly brackets to initialize everything at
once. I've tried to do that in the header, but I've learned that it doesn't
allow that.
I've consulted my Deitel book, and my c++ primer, but I can't seem to put
the pieces together.
If it's not too much to ask, could you please not use any STL if you reply;
I'm barely treading water with the regular language.
Thanks!