I have the following in my Board.h file:
Code:
class CBoard
{
public:
CBoard();
~CBoard();
int ReturnTile(int X, int Y);
protected:
int Grid[20][20];
};
Now, when I go to Board.cpp, after including the above .h file, and I type "CBoard::", the pop-up menu that appears only contains: Grid, ReturnTile, and ~CBoard. But no Constructor.
When I try to run the program, I get the error:
error C2228: left of '.ReturnTile' must have class/struct/union type
For the following code (Indicated at the *s):
Code:
CBoard MyBoard();
int TileReturn;
for (int XX = 0; XX <= 20; XX++)
{
for (int YY = 0; YY <= 20; YY++);
{
TileReturn = MyBoard.ReturnTile(XX, YY); //*****************
}
}
And incase you're wondering, all that the ReturnTile code is:
Code:
int CBoard::ReturnTile(int X, int Y)
{
return Grid[X][Y];
}
But again, I think this all links back to the constructor and it not being recognized. But if you see something else that's causing the problem, I'm all ears
Thanks for reading.
Erik