//constructor
{
for(int i = 0; i < MAXROWS; i++)
for(int j = 0; j < MAXCOLS; j++)
{
grid[i][j] = new Person;
}
return;
}
//destructor
{
for(int i = 0; i < MAXROWS; i++)
for(int j = 0; j < MAXCOLS; j++)
{
if(grid[i][j] != NULL)
delete grid[i][j];
}
return;
}
My destructor crashes the program, how do I make it delete the created dynamic memory without crashing, and why does it crash?
{
for(int i = 0; i < MAXROWS; i++)
for(int j = 0; j < MAXCOLS; j++)
{
grid[i][j] = new Person;
}
return;
}
//destructor
{
for(int i = 0; i < MAXROWS; i++)
for(int j = 0; j < MAXCOLS; j++)
{
if(grid[i][j] != NULL)
delete grid[i][j];
}
return;
}
My destructor crashes the program, how do I make it delete the created dynamic memory without crashing, and why does it crash?
Signature Space available for free, PM me if you'd like to use it.

