Website Summary Files Commits Branches @commit @diff @stats
path: root / DiamondProblemAndPolymorphism / Chess / Figure.hpp
blob: 157659b62011656d4b35960b4c3e3c94ea991f41 (plain) (blame)
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
#include <iostream>

using namespace std;

bool isValidCoord(int xCoord, int yCoord)
{
	return  xCoord >= 0 && xCoord <= 7
		&& yCoord >= 0 && yCoord <= 7;
}

class Figure
{
public:
	Figure(int xCoord, int yCoord, bool isWhite);

	int xCoord;
	int yCoord;
	bool isWhite;
	virtual bool Move(int xCoord, int yCoord) = 0;
	virtual void Print() = 0;
	virtual ~Figure(){};
};

Figure::Figure(int xCoord, int yCoord, bool isWhite);
{
	if (isValidCoord(xCoord, yCoord))
	{
		this->xCoord = xCoord;
		this->yCoord = yCoord;
		this->isWhite = isWhite;
	}
	else
		throw "Ivalid coordinates";
}