So I get the following error output on all of my functions when I try running my program:
1 2 3 4 5 6
Error 8 error C2244: 'List<T>::getLength' : unable to match function definition to an existing declaration
1> definition
1> 'int List::getLength(void) const'
1> existing declarations
1> 'int List<T>::getLength(void) const'
It's a template class so I have template <class T> in front of my class declaration...Why is this output telling me that List<T> is an incorrect way to define my function?
template <typename T>
class List
{
T t ;
int length ;
public:
int getLength() const ;
};
template <typename T>
int List<T>::getLength() const
{
return length ;
}
int main()
{
List<int> L ;
int l = L.getLength() ;
}