title: Trying to create a 2D array of a template class with unknown size (C++)
body: <p>I have a class with member variable:</p>
  
  <pre><code>T** board
  </code></pre>
  
  <p>This is supposed to represent cells on a game board, where each cell is of type <code>T</code> which is an abstract class. The size of the board is determined at runtime (hence the pointer and not the array declaration).</p>
  
  <p>In the constructor of the same class, I attempt to initialize the arrays that make up the board:</p>
  
  <pre><code>template&lt;class T, class J, const int X, const int Y&gt;
  Gameboard&lt;T,J,X,Y&gt;::Gameboard() {
      board = new T[X];
      for (int i = 0; i &lt; X; i++) {
          board[i] = new T[Y];
      }
  }
  </code></pre>
  
  <p>However, I'm getting the following error:</p>
  
  <pre><code>In file included from main.cpp:17:
  ./Gameboard.h:40:17: error: allocating an object of abstract class type 'Tile'
      board = new T[X];
  In file included from main.cpp:17:
  ./Gameboard.h:42:24: error: allocating an object of abstract class type 'Tile'
          board[i] = new T[Y];
  </code></pre>
  
  <p>How should I be doing this to properly create a 2D array?</p>