-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.h
43 lines (41 loc) · 1.13 KB
/
Player.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
/**
*header file of class Player
*Authors Alexey Titov and Shir Bentabou
*Version 1.0
**/
#pragma once
//libraries
#include <string>
#include "Board.h"
class Player{
public:
char myChar;
//Constructor
Player(char s){
if (s=='X' || s=='O' )
this->myChar = s;
else{
IllegalCharException ce;
ce.setCh(s);
throw ce;
}
}
//Copy constructor
Player(const Player& p){
this->myChar =p.myChar;
}
//Empty constructor
Player(){ }
//Get the player's char (myChar)
char getChar(){
return myChar;
}
//Set the player's char (myChar)
void setChar(char ch){
myChar = ch;
}
//Pure virtual function - must me implemented in classes that inherit from Player.
virtual const string name() const = 0;
//Pure virtual function - must me implemented in classes that inherit from Player.
virtual const Coordinate play(const Board& board) = 0;
};