I have a class Board
which contains a pointer array of pointers, called Space** bo
, each of the pointer points to an instance of the Space
class. I have a derived class called SnakesAndLaddersSpace
which inherits from Space
, and SnakesAndLaddersBoard
which inherits from Board
.
Essentially , in my SnakesAndLaddersBoard
class I want to change the Space** bo
, which it inherits, to SnakesAndLaddersSpace** bo
, how would I go about this?
This is what I'm doing in the SnakesAndLaddersBoard
Class
SnakesAndLaddersBoard::Board::Board(int w, int h)
{
width=w;
height=h;//set up the size of the board
bo = new SnakesAndLaddersSpace*[height]; // <<-- error
for(int i = 0; i < height; i++)
{
bo[i] = new SnakesAndLaddersSpace[width];
}
}
And here's the error I'm getting
SnakesAndLaddersBoard.cpp|13|error: invalid conversion from ‘SnakesAndLaddersSpace*’ to ‘Space*’ [-fpermissive]|