-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrps.h
49 lines (42 loc) · 897 Bytes
/
rps.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
37
38
39
40
41
42
43
44
45
46
47
48
49
// This header file declares and initializes the classes: Tool, Rock, Paper, and Scissors.
#ifndef RPS_H
#define RPS_H
#include <iostream>
using namespace std;
// Tool class with variables, constructor, and setStrength method
class Tool{
protected:
int strength;
char type;
public:
Tool();
Tool(int, char);
int getStrength();
void setStrength(int);
char getType();
void setType(char);
};
// Rock class with constructors and fight method
class Rock: public Tool{
public:
Rock();
Rock(int);
bool fight(Tool);
};
// Paper class with constructors and fight method
class Paper: public Tool{
public:
Paper();
Paper(int);
bool fight(Tool);
};
// Scissors class with constructors and fight method
class Scissors: public Tool{
public:
Scissors();
Scissors(int);
bool fight(Tool);
};
// Prototype to check the winner
void checkWinner(bool, Tool, Tool);
#endif