I am trying to make a class that is a players hand (in a card game for ex.). The draw method will draw another card, and showHand method should display the current cards in the hand. I have tried to initialize the array of pointers in the constructor, but am lost on how to do this (this is where I believe my issues stems from). trying the now commented out this->jon={}; gives this error: "error: incompatible types in assignment of '' to 'Card* [12]'"
***currently when in showHand if I just try to cout jon[i]->getRank() a bunch of nonsense just pops up; however Draw method works perfectly.
class myHand{
public:
myHand(){
this->size=0;
//this->jon={};
}
void Draw(Card anyCard) {
if(size>11) {
cout<<"You can only have a maximum of 12 cards in your hand at a time"<<endl;
return;
}
jon[size]=&anyCard;
cout<<"HERE IS ANYCRD:"<<jon[size]->getRank()<<jon[size]->getSuit()<<endl;
size++;
}
void showHand() {
//DOESNT WORK HERE
}
void Place(Card* anyCard) {
}
private:
int size;
Card* jon[12];
};