In the definition of foo::getX
(and setX
as well), what kind of foo
?
Because it's a template class, you have to specify that, like
template<typename T>
T foo<T>::getX(void) { ... }
You also have to tell the compiler that member functions are templates for each function in a templated class. So you have to do it for setX
as well:
template<typename T>
void foo<T>::setX(T x) { ... }