1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
class Player
{
public:
// Constructor ***********************************
// Uses default parameters or arguments passed
// Default arguments = "No Name"-pn, 1-ty, 1-lev, 25-str,
// 1-wty, 25-wdur, 1-wlevReq
// Precondition - None
// Postcondition - object is initialized with valid values
Player(string pn = "No Name", int ty = 1, int lev = 1, int str = 25,
int wty = 1, int wdur = 25, int wlevReq = 1);
// Copy Constructor ******************************
// Precondition - None
// Postcondition - None
Player(const Player& source);
// Overloaded Assignment *************************
// Precondition - None
// Postcondition - None
Player& operator=(const Player& source);
// Destructor ***********************************
// Precondition - None
// Postcondition - None
~Player();
// Mutator Functions ***************************
// . . .
// Accessor Functions **************************
// . . .
private:
Weapon * weapon1; // default = 1, 25, 1
string playerName; // default = "No Name"
int type; // default = 1 (1, 2, 3, 4)
int level; // default = 1
int strength; // default = 25
};
class Weapon
{
public:
// Constructor **************************************
// Uses default parameters or arguments passed
// Default arguments = 1-ty, 25-dur, 1-levReq
// Precondition - None
// Postcondition - object is initialized with valid values
Weapon(int ty, int dur, int levReq)
{
setType(ty);
setDurability(dur);
setLevelRequired(levReq);
//Destructor ***************************************
// Precondition - None
// Postcondition - None
~Weapon();
// Mutator Functions *******************************
// . . .
// Accessor Functions ******************************
// . . .
private:
int type; // valid values = 1, 2, 3, 4
int durability; // default = 25
int levelRequired; // default = 1 (>= 1 && <= 100)
};
|