Hi,

I'm using g++ 4.3.2. I have templated base class, an inherited subclass with specific template types, and I'd like to subclass that type further with subtypes of the template types.. but I can't see how.

In code:

Code:
class A { /* ... */ };

class B : public A { /* ... */ };   // B is a subtype of A

class C : public B { /* ... */ };   // C is a subtype of B

template <class T>
class BaseClass
{
   // note, not a list of T* -- I want to avoid using dynamic memory
   vector<T> listOfStuff; 
};

class Subtype : public BaseClass<A>
{
   // ... 
};

class YetAnotherSubtype : public Subtype
{
  // in here I would like to have access to an inherited 
  // listOfStuff<B>

  // I have lots of code in Subtype class that I want to reuse that
  // acts on listOfStuff, but in here I want them to act on B's not A's
};

// I might even want to keep going further, eg
// class Subtype3 : public YetAnotherSubtype { /*... */ }
// that has listOfStuff<C> and still reuses code from Subtype
There are performance reasons specific to my use of this code for avoiding declaring listOfStuff<T*> and using pointers and dynamic memory. If I have to I may, but I'd prefer not to.

It would be OK to have the list structure declared dynamic, eg vector<T>* listOfStuff, if that will help let me achieve the subtype relationship I want.

Any ideas?