I have this code in Player.h
class Player {
friend void clearBoard();
private:
static char board[4][4][4];
};
and this code in Player.cpp
char Player::board[4][4][4] = {};
void
clearBoard() {
for (byte i = 0; i < 4; i++)
for (byte j = 0; j < 4; j++)
for (byte k = 0; k < 4; k++)
board[i][j][k] = ' ';
}
so during compilation I get an error
Player.cpp:37:9: error: ‘board’ was not declared in this scope
37 | board[i][j][k] = ' ';
| ^~~~~
I use board
literally hundred other times in the Player.cpp
and using Player::
with each one will negatively affect readability an my nerves.
Is there a way to escape this hell?
I have tried
using Player::board;
using Player::board[][][];
Enclosing my class with namespace, then using that namespace.
without any effect.
All suggestions except
"just redefine
clearBoard()
asstatic
"
will be greatly appreciated.