I'm having some problems on returning the parameter of a method as a template, look:
// CTestClass.h
template<class T>
class CTestClass
{
public:
T getNewValue();
};
// CTestClass.cpp
template<class T>
T CTestClass<T>::getNewValue()
{
return 10; // just for tests I'm returning hard coded 10
}
// main.cpp
int _tmain(int argc, _TCHAR* argv[])
{
CTestClass<int> s;
int a = s.getNewValue();
return 0;
}
I got the following error:
error LNK2019: unresolved external symbol "public: int __thiscall CTestClass::getNewValue(void)" (?getNewValue@?$CTestClass@H@@QAEHXZ) referenced in function _wmain