
please wait
|
|
|
|
Dice(int)
works as a constructor - it should be Dice(int number)
where "number" is a parameter name. Same applies to void setRolls
(try using these functions/constructors - I expect it'll throw errors as soon as you try using it).it should be Dice(int number) where "number" is a parameter name |
|
|
Dice
class, what does a score have to do with the dice. Think of it this way, lets say you use these dice in different games, Dice by itself is very generic, it has sides which have a value on each face of the side. Dice can be rolled, that is about it. I say you either have another class that handles these or you make some non member functions do these jobs, otherwise you limit the re-usability of a Dice
.richardn413: 1. You also ought to include a destructor: |
clanmjc (503) May 2, 2012 at 8:49am it should be Dice(int number) where "number" is a parameter name You can declare member and non-member function with anonymous parameters (no parameter name). You just need to name them in the implementation. To OP - I'm going to guess it's because this Dice class has a lot going on. 1 2 3 4 5 6 int playerPoints(); int compPoints(); int computerTotal(); double score(); double randPoints; int pointTotal These members don't belong in the Dice class, what does a score have to do with the dice. Think of it this way, lets say you use these dice in different games, Dice by itself is very generic, it has sides which have a value on each face of the side. Dice can be rolled, that is about it. I say you either have another class that handles these or you make some non member functions do these jobs, otherwise you limit the re-usability of a Dice. |