Deth <alexrepair@xxxxxxxxx> writes: > Thanks Ian, but my code is definitely correct - lookup "template template" > parameters if you're not familiar with the syntax in my post. You're right, I misunderstood what you wanted to do, but I'm not convinced your code is correct according to the standard. Your original example said template <typename> class B : public A { so it didn't provide any type for A's template parameter. Shouldn't it be template <typename> class B : public A<B> { ? Otherwise, how does the compiler know what to use for A's template parameter? The problem then boils down to: how do you write the constructor B(int i) : A<...>(i) {} The problem is that when you write B(int i) : A<B>(i) {} B refers to the instantiated class B<>, not the template B. So you need to qualify it. Is this code what you are after? template <template <typename> class T> class A { public: A(int) {} }; template <typename> class B : public A<B> { public: B(int i) : A< ::B>(i) {} }; (note the space required between "<" and "::" to avoid a digraph). > This code without inheritance illustrates the problem a little clearer: > > //template template syntax is required to allow A::makeAnIntC() to > //return a new template instantiation of C > template <template <typename> class C> > class A { > C<int> makeAnIntC() {return C<int>(5);} > }; > > template <typename T> > class B { > public: > B<int> makeAnIntB() {return A::makeAnIntC();} //Compile error here > }; You're using A with no template parameter, and that is precisely what the compiler complains about. > Note that the following will compile and work: > class Foo { > B<int> makeAnIntB() {return A::makeAnIntC();} //Not self-referential > }; I see an error with this version as well. foo.cc:15: error: ‘template<template<class> class C> class A’ used without template parameters Ian