-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCell.cpp
More file actions
27 lines (25 loc) · 776 Bytes
/
Cell.cpp
File metadata and controls
27 lines (25 loc) · 776 Bytes
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
#include <iostream>
#include <string>
#include <stdio.h>
#include "Cell.h"
using namespace std;
char Cell::get()const{
return this->value;
}
void Cell::set(char c){
if(c != 'X' && c != 'O'&& c != '.'){
throw IllegalCharException(c);
}
else { this->value=c;}
}
Cell& Cell::operator= (char c){
this->set(c);
return *this;
}
Cell& Cell::operator= (const Cell& c){
this->value=c.value;
}
bool Cell::operator ==(char c) const {if(value==c)return true; return false;}
bool Cell::operator ==(const Cell& c) const {if(this->value==c.get())return true; return false;}
bool Cell::operator !=(char c) const {if(!(value==c))return true; return false;}
bool Cell::operator !=(const Cell& c) const {if(!(this->value==c.get()))return true; return false;}