
November 14th, 2012, 05:43 AM
|
 |
User
|
|
Join Date: Feb 2005
Location: UK
|
|
|
Homework - Sending values from one class to another
Hi,
I'm creating a simulator for a game of rummy and I'm now stuck with dealing the cards. I have a class for each player:
Code:
class Player{
private Card[] currentCards;
public Player(){
currentCards = new Card[8];
}
public void giveCard(int index, int value, char suit){
currentCards[index] = new Card(value, suit);
}
}
and I have another class called Deck that will basically create a deck of cards, shuffle them and then produce 7 values for each player from within that deck.
How can I take an integer value that is within a function inside the Deck class and send it to the function giveCard inside the Player class?
Thanks,
Sephers.
__________________
|