Question: Dice class definition is given below. class Dice { public: Dice ( int sides ) ; int Roll ( ) ; int NumSides ( )
Dice
class
definition
is
given
below.
class Dice
public:
Diceint sides;
int Roll;
int NumSides const;
int NumRolls const;
private:
int myRollCount;
int mySides;
;
In this question your task is to add a new member function to Dice class. This member function is called ResetRollCount and should reset the roll count of the dice object to zero without recreating it
a Show the necessary changes in the class definition in order to add ResetRollCount member function. Give your answer on the class definition above.
b Is ResetRollCount member function an accessor or mutator? Justify your answer.
c Write the implementation of ResetRollCount member function.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
