I am making a game and for the map I have a dynamic array:
Tile ** Ground;
I want the ground/map to be const so you simply just cant change the pointers direction.
I tried this one: Tile const*const* Ground;
But I cant define it afterwards!
The code for making the map is this:
1 2 3 4
Tile ** Ground;
Ground = new Tile const*[m_X];
for(unsignedint x = 0 ; x < m_X ; x++)
Ground[x] = newconst Tile[m_Y];
You could move the initialization code to a separate function that return Tile ** and do Tile const*const* Ground = function();.
Note that 'Tile const*const*' makes the Ground pointer variable. You probably want either 'Tile const*const*const' or 'Tile *const*const'.