I am writing code for a poker game, but I am having problems figuring out a way to pass value from a class object..in this case class card..object deck.. I want to do this to simulate dealing 5 cards to a player..I created another object of type card called player1.. so after creating the deck ..and then shuffling the deck..i want to draw 5 cards from the object deck..and pass it to the object player1..
However when I print to screen to see if value is passed in i only get the adress of cell..not the value. Here is the code
code for class deck
[code]
class Card
{
public:
int face;
int suit;
void toString() {
cout<<FaceString[face]<<" of "<<SuitString[suit]<<endl;
}
};
[/code]
code for class of deal
[code]
class deal
{
public:
Card deck[52];
void toDisplay(){
for (int j = 0; j < 5; j++) {
cout<<"player card "; deck[j].toString();
}
}
};
[\code]
[code]
//creation of both objects
Card deck[52];
Card player1[5];
[/code}
in main
player1.deck; <<==[Error] request for member 'deck' in 'player1', which is of non-class type 'deal [5]'