L
Lee Garrington
Hey,
I have just revamped a program so that it makes use of inheritance and a bug
that I cannot explain has crept in.
PlayingBoard inherits from Board.
Board contains the int variables iWidth and iHeight along with a 2d array of
int defined as **board.
The PlayingBoard constructor is as follows
PlayingBoard:layingBoard(HWND hwnd, int width, int height):
Board(width, height)
{
//do some stuff
}
The Board as
Board::Board(int width, int height):
iWidth(width),
iHeight(height)
{
CreateBoard(); //creates the 2d array in memory depending on the
width/height
}
I am pretty sure the error is scope related. I can access the array within
both constructors but as soon as I come out of them I get memory violation
errors when attempting to access the board.
Where I am going wrong?
Thx in advance
Lee
I have just revamped a program so that it makes use of inheritance and a bug
that I cannot explain has crept in.
PlayingBoard inherits from Board.
Board contains the int variables iWidth and iHeight along with a 2d array of
int defined as **board.
The PlayingBoard constructor is as follows
PlayingBoard:layingBoard(HWND hwnd, int width, int height):
Board(width, height)
{
//do some stuff
}
The Board as
Board::Board(int width, int height):
iWidth(width),
iHeight(height)
{
CreateBoard(); //creates the 2d array in memory depending on the
width/height
}
I am pretty sure the error is scope related. I can access the array within
both constructors but as soon as I come out of them I get memory violation
errors when attempting to access the board.
Where I am going wrong?
Thx in advance
Lee