Reputation: 963
Say, I have a parent class template. And want to build several child class upon it. Each child class are typename specific. So can I specify the typename they use when inherit their parent class template?
example of the class definition:
template <class tName1, class tName2>
class parent
{
tName1 a;
tName2 b;
...
}
class child: public parent<int, float>
{
...
}
Is this code correct?
Upvotes: 0
Views: 152
Reputation: 963
Yes, I can do it. It seems like each time I call a template in C++, I have to specify its type or make it into another template. In this case it's specifying its type.
Upvotes: 1