I believe it should be like this:
Code:
Anthony.Location = new Space*[10];
for( int i=0;i<10;i++){
Anthony.Location[i]=new Space[5];
}
//...
for( int i=0;i<10;i++){
delete [] Anthony.Location[i];
}
delete [] Anthony.Location;
Also, your class design isn't all that great. Any data in a class should generally be declared with private scope, and then you should declare a constructor and destructor to allocate/deallocate memory:
Code:
class Player
{
public:
Player(int r=10,int c=5);
~Player();
private:
Space** Location;
int rows,cols;
};
Player::Player(int r, int c)
{
rows=r;
cols=c;
Anthony.Location = new Space*[r];
for( int i=0;i<r;i++){
Anthony.Location[i]=new Space[c];
}
}
Player::~Player()
{
for(int i=0;i<rows;i++){
delete [] Anthony.Location[i];
}
delete [] Anthony.Location[i];
}
You should probably review a tutorial on classes before you move on
Edit: Whoops missed the [] in the second part