title: "Error: expression must have a pointer type" when using the "this" keyword
body: <p>So I made a parent class, which i will call <code>Parent</code> that has a <code>Square*</code> grid member variable. The grid variable is a pointer to a large array of Squares, which contain <code>key</code> member variables. (Think of this project as a hashtable) The problem is I am making a function in the <code>Parent</code> class that edits the key variables in the <code>Square</code> array, and getting an error. This line of code compiles: </p>
  
  <pre><code>this-&gt;grid = new Square[row*col];
  </code></pre>
  
  <p>but this line does not compile:</p>
  
  <pre><code>this-&gt;grid[i*col + j]-&gt;key1 = j;
  </code></pre>
  
  <p>it underlines <code>this</code> and says expression must have a pointer type. I was wondering if anyone had ideas to what i may be doing wrong?</p>
  
  <pre><code>void Parent::initialize(int row,int col) {
      this-&gt;grid = new Square[row*col];
      for(int i = 0; i &lt; row; i++) {
          for(int j = 0;j &lt; col; j++) {
              this-&gt;grid[i*col + j]-&gt;key1 = j;
              this-&gt;grid[i*col + j]-&gt;key2 = i;
          }
      }
  </code></pre>