title: a non static member reference must be relative to a specific object c++
body: <p>When creating a multidimensional array im getting the following error:</p>
  
  <pre><code>a non static member reference must be relative to a specific object c++
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>class Level
  {
  private:
      int width = 6;
      int height = 6;
      Room rooms[width][height];
  public:
      Level();
      ~Level();
  };
  </code></pre>
  
  <p>When width and height are replaced, when creating the array, with 6 (the value of the int's) it works. Why can't I use an int that holds the same value?</p>
  
  <p>I don't need variable sizes (else I should use a vector), I thought using some variables would make it more readable for others when reading it.</p>
  
  <p>In my constructor im going to fill the array in a for loop like:</p>
  
  <pre><code>Level::Level(int id)
  {
      for (int i = 0; i &lt; levelWidth; i++)
      {
          for (int x = 0; x &lt; levelHeight; x++)
          {
            //Do the filling here
          }
      }
  }
  </code></pre>