Three classes Zoo, ZooObject and Animal are present.Is it valid to declare a 2D array of ZooObjects like mentioned below? If so, how do i initialise it? I am familiar with dynamically allocating a 2D array, but can't figure out this one.
class ZooObject;
class Zoo {
 public:
  int rows, cols;
  ZooObject ***zooArray;
  Zoo(int rows, int cols) {
    this->rows = rows;
    this->cols = cols;
    // dynamically initialize ***zooArray as a 2D array with each 
    //element of type Animal
    // initially initialized to NULL.
 // initialize each row first.
    for (i = 0; i < rows; i++) {
      zooArray[i] = new ZooObject *[cols];
    }
    // initialize each column.
    for (i = 0; i < rows; i++) {
      for (j = 0; j < cols; j++) {
        Animal animal;
        zooArray[i][j] = &animal;
      }
    }
  }
};
class ZooObject {
 public:
  bool isAlive;
};
class Animal : public ZooObject {
 public:
  bool isHerbivore;
};
int main() { Zoo *zoo = new Zoo(3, 3); }
 
    