Possible Duplicate:
C++ class template of specific baseclass
class Base
{
...
};
class Derived1 : public Base
{
...
};
class Derived2 : public Base
{
...
};
class Unrelated
{
...
};
I want to have a class template ClassTemplate that accepts as parameter only classes Derived1 and Derived2 but not Unrelated, so I can do:
ClassTemplate<Derived1> object1;
ClassTemplate<Derived2> object2;
but I shouldn't do:
ClassTemplate<Unrelated> object3;
Is it possible at all?