Can a Specialized Template Class Inherit from Another Specialized Template Class?
<p>I first defined</p>

<pre><code>class Hash
{

};
</code></pre>

<p>Then a specialization of Hash.</p>

<pre><code>template &lt;class T&gt;
class Hash&lt;int, T&gt;
{
public:
    Hash(int slotN = 11);

    bool insert(int key, T val);
    bool remove(int key);
    bool contains(int key);
    bool query(int key, T&amp; val) ;

protected:
    // Basic Variables of the Hash Model.
    list&lt;int&gt;* slot;
    list&lt;T&gt;* slotVal;
    int slotN;
};
</code></pre>

<p>I want to use this specialized version of Hash
to implement another specialization: Hash of
String-Valued Keys.</p>

<pre><code>template &lt;class T&gt;
class Hash&lt;string, T&gt; : public Hash&lt;int, T&gt;
{
public:
    Hash(int slotN);

    bool insert(string key, T val);
    bool remove(string key);
    bool contains(string key);
    bool query(string key, T&amp; val) ;

private:

    // Calculate the String's Hash Key.
    int str2key( string key);
};
</code></pre>

<p>But it seemed I cannot access fields in the class Hash. Why?</p>
