first of all, I'm quite new to OOP so please bear with me...
I'm currently trying to create a Tic-Tac Toe terminal game in c++, for this, I'm trying to use a private int _size
to create a 2d-array called char _board[_size][_size]
, but I find an error, which I don't quite understand. I did asign a value to _size
on the constructor.
Invalid use of non-static data member 'Board::_size'
Board.h:
#ifndef BOARD_H
#define BOARD_H
class Board
{
public:
Board(int size);
void printBoard();
private:
int _size;
char _board[_size][_size];
};
#endif // BOARD_H
So, how can I solve this error, or how do you recommend I approach this problem?