c++ - passing value by reference but still showing address not value -
i writing code poker game, having problems figuring out way pass value class object..in case class card..object deck.. want simulate dealing 5 cards player..i created object of type card called player1.. after creating deck ..and shuffling deck..i want draw 5 cards object deck..and pass object player1..
however when print screen see if value passed in adress of cell..not value. here code
code class deck
[code]
class card { public: int face; int suit; void tostring() { cout<<facestring[face]<<" of "<<suitstring[suit]<<endl; } };
[/code]
code class of deal
[code]
class deal { public: card deck[52]; void todisplay(){ (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 member 'deck' in 'player1', of non-class type 'deal [5]'
you got wrong function signature:
this prototype
void deal(const int wdeck[][13], const char *wface[], const char *wsuit[]);
this function implementatiion
void deal(const int wdeck[][13], const char *wface[], const char wsuit[] ) { // blah blah }
you miss *
Comments
Post a Comment