|
|||
|
We're making a sort of yahtzee-type dice game.
There are two classes, Die, and Dice. Dice serves as a collection and means of manipulating multiple Die at a time. The class for the dice is relatively simple and unimportant at the moment storing a 'size' value, a 'value' value, along with set, get, and roll methods. In the 'Dice' Class, I add desired Die into an ArrayList, as I was told to. Adding Die to this list is not difficult. However, I am also to be able to add Die from a and existing 'Dice' object. Here's what I've got so far. Java Code:
public void add( Die dieToAdd )
{
diceArray.add( dieToAdd );
}
This part seems to work fine. (I've already declared the ArrayList a while back.) Now here is where I get problems. Java Code:
public void add( Dice diceToAdd )
{
Collections.copy(diceToAdd.diceArray,this.diceArray);
}
Why this does not work is beyond me. Please help. Much appreciated. Edit/Delete Message |
![]() |
| Thread Tools | |
| Display Modes | |
|
|