TITLE: how to use "inherited" typedefs (Newsgroups: comp.lang.c++.moderated, 21 Feb 2000) MULCHANDANI: Kishore Mulchandani >template >class A >{ > public : > typedef T* ptrT; > A(ptrT a){e_a = a;} > > private: > ptrT a; > >}; > >template >class B: public A >{ > public : > B(ptrT t) : A( t) {} ////Error: illegal constructor/destructor declaration >}; NARAN: sbnaran@uiuc.edu (Siemel B. Naran) Your Metroworks compiler is right. One may specialize A so that it does not have the 'ptrT' typedef, or so that 'ptrT' is a static const variable. Then the constructor of B would be an error. But the rules of C++ ensure that template code is processed and precompiled as much as possible. This means it should be known exactly where 'ptrT' comes from. Hence, your two solutions are, template class B: public A { public : using A::ptrT; // or "typdef typename A::ptrT ptrT" B(ptrT t) : A( t) {} }; template class B: public A { public : B(typename A::ptrT t) : A( t) {} }; But I'd just use "T *" once and for all. _______________________________________________ cpptips mailing list http://cpptips.hyperformix.com