title: C++ Template class inheriting another template class with a template-specified input type
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/11405/gcc-problem-using-a-member-of-a-base-class-that-depends-on-a-template-argument">GCC problem : using a member of a base class that depends on a template argument</a><br>
    <a href="https://stackoverflow.com/questions/2812470/why-does-gcc-need-extra-declarations-in-templates-when-vs-does-not">Why does GCC need extra declarations in templates when VS does not?</a><br>
    <a href="https://stackoverflow.com/questions/1239908/why-doesnt-a-derived-template-class-have-access-to-a-base-template-class">Why doesn&rsquo;t a derived template class have access to a base template class</a><br>
    <a href="https://stackoverflow.com/questions/2369553/iphone-compiler-inherited-templated-base-classes-with-passed-through-type-not-bei">iphone compiler inherited templated base classes with passed through type not being expanded in time (just look)</a>  </p>
  </blockquote>
  
  
  
  <p>Sorry for the confusing title, best I could come up with.</p>
  
  <p>Here's some code to illustrate my problem...</p>
  
  <p>A base template class:</p>
  
  <pre><code>template&lt;class T&gt; class TestBase
  {
  public:
     int someInt;
  };
  </code></pre>
  
  <p><br /></p>
  
  <p><em>Attempting to subclass TestBase with another template class...</em></p>
  
  <p>This gets "someInt was not declared in this scope" at compile time:</p>
  
  <pre><code>template&lt;class X&gt; class TestSub : public TestBase&lt;X&gt;
  {
     void testf()
     {
         someInt = 0; //Error: "someInt was not declared in this scope"
     }
  };
  </code></pre>
  
  <p><br /><br />
  B)
  This works fine (the difference being that I specify TestBase's template input explicitly)</p>
  
  <pre><code>template&lt;class X&gt; class TestSub : public TestBase&lt;string&gt;
  {
     void testf()
     {
         someInt = 0;
     }
  };
  </code></pre>
  
  <p><br /><br /></p>
  
  <p>Why does TestSub from (A) not inherit someInt correctly as it does in (B)?</p>
  
  <p>Thanks in advance.</p>