Alright, I'm making an object oriented Battleship game, there are 2 classes, 'Ship' and 'Board'
The board is the ocean that the ships are placed in, and there are 2 objects of this class for every game that is played.
The class contains a member variable m_oceanArray of type short int.
The classes constructor then trys to initalize this pointer to a size of [x] and [y]. X and Y are two values passed to the constructor, based on the users input.Code:short int *m_oceanArray;
I'm probably doing something horribly wrong, but I don't know what! Logic suggests I have to use something like realloc() to do this, but I'm unsure..Code:m_oceanArray = new short int[x][y];
Thanks in advance.