Why would the following work just fine:
class a
{
public:
int n;
};
class b : public a
{
public:
b()
{
n = 1;
}
};
int main()
{
}
but this does not work:
template <class T>
class a
{
public:
int n;
};
template <class T>
class b : public a<T>
{
public:
b()
{
n = 1;
}
};
int main()
{
}
and gives the following error:
1.cpp: In constructor āb<T>::b()ā:
1.cpp:14: error: ānā was not declared in this scope
and how would one inherit a template class while being able to use its base members and keep the type generic?