Estoy trabajando con matrices de objetos dinamicos y el problema es que necesito ingresar un objeto habitacion a una matriz pero solo agrega al primer espacio de la matriz en otras palabras al espacio matriz[0][0] si alguien me puede ayudar con eso se lo agradezco, dejo el codigo para que lo analicen gracias..
//Esta es la estructura de la matriz
Matriz::Matriz(int f, int c) : filas(f), columna(c) {
matriz = new Habitacion** [filas]; // Columna Filas
for (int i = 0; i < filas; i++)
matriz[i] = new Habitacion* [columna];
for (int i = 0; i < filas; i++)
for (int j = 0; j < columna; j++)
matriz[i][j] = NULL;
}
// Este es el metodo que necesito
bool Matriz::RegistroCLiente(Habitacion* hab) {
for (int i = 0; i < filas; i++)
for (int j = 0; j < columna; j++)
if (matriz[i][j] == NULL) {
matriz[i][j] = hab;
return true;
}
else
return false;
}