Okay, now I've got a real brain blender...
I've got a base class: A
There are two derived classes: B, C
B is a template for any derived type of C.
C is an ADT that needs a data member that is a pointer to a B. Therein lies my trouble. Such a thing is circular, so how can it be done?
Let me illustrate:
Code:
class A {
};
template <typename T>
class B : public A {
};
class C : public A {
B<C> *pointerToB;// B<C2>* would work, but C2 is user-defined
void foo() = 0;// for clarity
};
//
// user's code follows
//
class C2 : public C {
void foo() { }
};
class B2 : public B<C2> {
};
I cannot create the variable pointerToB because I need to specify the template parameter for B, but I cannot do that because that class is defined by the user (derived from C).
This is either a strange problem that has an easy fix one of you knows about or it's a very poorly designed set of classes.
I guess if all else fails I can just make the pure virtual functions stop being pure virtual, but hopefully there is another solution.