So this is what my problem is it has to roll some dies and find some numbers so like how I have it now RollingDice rolls 2 dices and finds the sum but how the RollingDice gets it roll it must go through PairOfDice and PairOfDice must go through Die and then it should come around and return it back to RollingDice but when it gets returned I get this:
So I am not sure what this is all about.
Like In my Rollingdice2 class I make 2 objects called:
Originally posted by Michael Hubele: ...Die one: PairOfDice@360be0 , Die Two: PairOfDice@45a877
So I am not sure what this is all about...
You are getting this output because the class PairOfDice has not overridden the toString method. Therefore, you are getting the default toString behavior inherited from Object, which is the class name concatenated with the "at" sign and a memory location.
If you want more meaningful information, you will need to override the toString method in the PairOfDice class.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Since a PairOfDice has two instances of Die, don't you really want just one pair (assigned to a variable with a name that suggests a pair rather than a single die)? [ February 27, 2006: Message edited by: marc weber ]
Well, aside from the names being misleading, the way it's written above, a PairOfDice has two instances of Die, along with a separate roll method for each instance. So if die1 and die2 each point to a separate instance of PairOfDice, then when you call...
...you're just rolling the first instance of Die in the pair die1, and the second instance of Die in the pair die2. So die1.two and die2.one aren't doing anything.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Need Help With returning some int numbers.