title: C++ template class inheritance
body: <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  template &lt;class T&gt;
  class C1
  {
  public:
      int n;
      C1(int a)
      {
          n=a;
      }
      T mat[50][50];
      void readmat()
      {
          int i,j;
          for(i=1; i&lt;=n; i++)for(j=1; j&lt;=n; j++)cin&gt;&gt;mat[i][j];
      }
      void showmat()
      {
          int i,j;
          for(i=1; i&lt;=n; i++)
          {
              cout&lt;&lt;endl;
              for(j=1; j&lt;=n; j++)cout&lt;&lt;mat[i][j]&lt;&lt;&quot; &quot;;
          }
      }
  };
  
  template &lt;class T&gt;
  class C2: public C1&lt;T&gt;
  {
      C2(int a): C1(a) {};
  
  };
  </code></pre>
  <p>Whenever I run it, I get the error:</p>
  <blockquote>
  <p>In constructor C2::C2(int)':</p>
  <p>error: class 'C2' does not have a field named 'C1'</p>
  </blockquote>
  <p>If someone could explain to me what I did wrong, I would mostly appreciate it.</p>