title: multidimensional array of objects in c++
body: <p>I'm writing assignment (creating virtual world) and I've encountered one thing I can't go over. I have class Organism which is an abstract for all the future inheriting ones (animals etc.) and class World which represents the world of these objects. In the latter I can't create an array of Organisms though - to store position of every existing organism. </p>
  
  <p>It throws:
  "syntax error : missing 'token1' before 'token2'</p>
  
  <p>I was thinking that maybe it has something to do with that it refers to each other (organism has reference to certain world and certain world wants to create array of organisms) but default constructor is solving that thing imo.</p>
  
  <p>Could you tell what have I overseen? Thanks in advance.</p>
  
  <p><strong>World.h</strong></p>
  
  <pre><code>#pragma once
  class World
  {
  private:
      int sizeX;
      int sizeY;
      Organism * worldMesh;
  public:
      World(int sizeX, int sizeY);
      void nextTurn();
      void drawWorld();
      int getWorldX();
      int getWorldY();
  ~World();
  };
  </code></pre>
  
  <p><strong>World.cpp</strong></p>
  
  <pre><code>#include "stdafx.h"
  #include "World.h"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  World::World(int sizeX, int sizeY)
  {
      this-&gt;sizeX = sizeX;
      this-&gt;sizeY = sizeY;
      worldMesh = new Organism[sizeX][sizeY];
      for (int i = 0; i &lt; sizeX; i++) {
          for (int j = 0; j &lt; sizeY; j++) {
              worldMesh[i][j] = NULL;
          }
      }
  } ....
  </code></pre>
  
  <p><strong>Organism.h</strong></p>
  
  <pre><code>#pragma once
  #include "World.h"
  #include "Position.h"
  
  
  class Organism
  {
  protected:
      int strength;
      int initiative;
      Position * position;
      static World * world;
  public:
      Organism();
      Organism(World * world);
      int randValue();
      virtual void spawn();
      virtual void action();
      virtual void collision();
      void kill();
      virtual ~Organism();
  };
  </code></pre>