Hi guys,
I'm just learning c++ coming from a Java background.
Just playing around with simple classes now, but for some reason the following won't compile, when the same syntax compiles fine elsewhere:
class CardDealer {
private:
string suits[4];
string values[13];
bool cardTaken[4][13];
int getRand(int top);
void getValidSuit(int *suit);
void getValidCard(int suit,int *value);
public:
CardDealer();
string dealCard();
void resetDeck();
};
CardDealer::CardDealer(){
suits = {"hearts", "clubs", "spades", "diamonds"};
values = {"ace","two","three","four","five","six","seven","eight","nine","ten","jack","queen","king"};
cardTaken = {{false,false,false,false,false,false,false,false,false,false,false,false,false},{false,false,false,false,false,false,false,false,false,false,false,false,false},
{false,false,false,false,false,false,false,false,false,false,false,false,false},{false,false,false,false,false,false,false,false,false,false,false,false,false}};
}
obviously this is just a part of the class so please don't yell at me for missing '}'s
compiler chucks a wobbly when it hits the instantiations in the constructor, spits out errors like these:
1>.\CardDealer.cpp(26) : error C2059: syntax error : '{'
1>.\CardDealer.cpp(26) : error C2143: syntax error : missing ';' before '{'
1>.\CardDealer.cpp(26) : error C2143: syntax error : missing ';' before '}'
1>.\CardDealer.cpp(27) : error C2059: syntax error : '{'
1>.\CardDealer.cpp(27) : error C2143: syntax error : missing ';' before '{'
1>.\CardDealer.cpp(27) : error C2143: syntax error : missing ';' before '}'
1>.\CardDealer.cpp(28) : error C2059: syntax error : '{'
line 26 is the one where I've instantiated suits (suits = {
...)
thanks for taking a look guys, much appreciated