Reputation: 188
I have the following template base class:
template <class K>
class Base
{
protected:
Base(int tableSize) : m_tableSize(tableSize) {}
int doBaseWork(const K& data);
private:
int m_tableSize;
};
And this template class inherits it:
template <class K>
class Derived : public Base<K>
{
public:
Derived (int tableSize) : Base(tableSize){}
private:
int doDerivedWork();
};
Then somewhere in the code i use:
Derived<int> testDerived(10);
When compiling with gcc i get the following error
class 'Derived<K>' does not have any field named 'Base'
What am i doing wrong? it seems like gcc thinks i'm trying to initialize a member, but i'm just trying to initialize base.
Upvotes: 0
Views: 100