-
Notifications
You must be signed in to change notification settings - Fork 0
/
container.h
36 lines (27 loc) · 877 Bytes
/
container.h
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
//=======================
// container.h
//=======================
// The so-called inventory of a player in RPG games
// contains two items, heal and magic water
#ifndef _CONTAINER // Conditional compilation
#define _CONTAINER
class container // Inventory
{
protected:
int numOfHeal; // number of heal
int numOfMW;
int numOflu;// number of magic water
public:
container(); // constuctor
void set(int heal_n, int mw_n, int lu_n); // set the items numbers
int nOfHeal(); // get the number of heal
int nOfMW(); // get the number of magic water
int nOflu();
void display(); // display the items;
bool useHeal(); // use heal
bool useMW(); // use magic water
bool useluck();
// addition 1: add the heal and magic water after victory
friend container operator+(const container &x, const container &y);
};
#endif