CUtil<char>::input(command);
I wrote the code above in "main.cpp" and I made a header file for that code, which is written below.
But I received the following error message:
C2352: 'class::function' : illegal call of non-static member function.
What's the problem?
#ifndef CUTIL_H
#define CUTIL_H
template <typename T>
class CUtil {
public:
void input(T& command) {
std::cin >> command;
if (std::cin.fail()) {
std::cin.clear();
std::cin.ignore(100, '\n');
}
}
};
#endif