Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can i inherit a templated class 1

Status
Not open for further replies.

Sedai

Programmer
Mar 4, 2001
158
US
as simple as that, but gave me loads of trouble...

can I have a templated class as a superclass and derive subclasses from it?

help appreciated! Avendeval Sedai
yavoor@yahoo.com

 
Yes, you should follow this syntax:

template<class T> class x{};
template<class TT>class y:x<int>{};
template<class T>class xx:x<char*>{};
int main()
{
return 0;
} John Fill
ivfmd@mail.md
 
probably it's a stupid question, but why do i need the double T in the first example
template<class TT>class y:x<int>{};

anyway, thank you for your help! Avendeval Sedai
yavoor@yahoo.com

 
You can put a triple T, or everithing what do you want. Is up to you. John Fill
ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top