Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Coord
- {
- public:
- Coord() {}
- Coord(int x, int y)
- {
- this->m_x = x;
- this->m_y = y;
- }
- int GetX() {return this->m_x;}
- int GetY() {return this->m_y;}
- void SetX(int x) { this->m_x = x;}
- void SetY(int y) { this->m_y = y;}
- private:
- int m_x;
- int m_y;
- };
- class Figure
- {
- public:
- Figure()
- {
- this->m_figureCharacter = '-';
- this->m_figureName = "Empty";
- }
- Figure(string name, char figure)
- {
- this->m_figureCharacter = figure;
- this->m_figureName = name;
- }
- char GetFigureCharacter() { this->m_figureCharacter;}
- string GetFigureName() { this->m_figureName;}
- private:
- char m_figureCharacter;
- string m_figureName;
- };
- class Table
- {
- public:
- Table()
- {
- Figure emptyFigure = Figure("test", '-');
- for(int i = 0; i < 8; i++)
- {
- for(int j = 0; j < 8; j++)
- {
- this->m_table[i][j] = emptyFigure;
- cout << m_table[i][j].GetFigureName() << endl;
- }
- }
- }
- Figure GetFigure(Coord coord) {return this->m_table[coord.GetX()][coord.GetY()];}
- void SetFigure(Coord coord, Figure figure) { this->m_table[coord.GetX()][coord.GetY()] = figure;}
- private:
- Figure m_table[8][8];
- };
- int main()
- {
- Table current = Table();
- //cout << current.GetFigure(Coord(1,3)).GetFigureName() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement