-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell.cpp
42 lines (34 loc) · 808 Bytes
/
Cell.cpp
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
// a. Michael Bertagna
// b. 2353491
// c. bertagna@chapman.edu
// d. CPSC 350-01
// e. Assignment 3
/* Cell.cpp contains the implementation of the Cell class. It implements a default constructor, a destructor, and four functions:
1) setOccupied: sets cell occupied
2) setEmpty: sets cell empty
3) isOccupied: checks if cell occupied ('X')
4) getValue: returns value ('X' or '-')
*/
#include "Cell.h"
// default constructor
Cell::Cell(){
m_value = '-';//set as empty initially
}
// destructor
Cell::~Cell(){}
// sets cell occupied
void Cell::setOccupied(){
m_value = 'X';
}
// sets cell empty
void Cell::setEmpty(){
m_value = '-';
}
// checks if cell occupied ('X')
bool Cell::isOccupied(){
return (m_value == 'X');
}
// returns value ('X' or '-')
char Cell::getValue(){
return m_value;
}