title: Why do I have to access template base class members through the this pointer?
body: <p>If the classes below were not templates I could simply have <code>x</code> in the <code>derived</code> class. However, with the code below, I <em>have to</em> use <code>this-&gt;x</code>. Why?</p>
  
  <pre><code>template &lt;typename T&gt;
  class base {
  
  protected:
      int x;
  };
  
  template &lt;typename T&gt;
  class derived : public base&lt;T&gt; {
  
  public:
      int f() { return this-&gt;x; }
  };
  
  int main() {
      derived&lt;int&gt; d;
      d.f();
      return 0;
  }
  </code></pre>