Below is the code
template <class T>
class Demo
{
public:
T var;
Demo(T a)
{
var = a;
}
void PrintDemo()
{
cout << "In generic PrintDemo " << var << endl;
cout << "Var is " << var << endl;
}
template<typename int>
void PrintDemo()
{
cout << "In int PrintDemo " << var << endl;
cout << "Var is " << var << endl;
}
};
When I compile this code, I get below error:
main.cpp:18:23: error: expected nested-name-specifier before ‘int’
18 | template<typename int>
Can some one help me out to understand the error?
This is my requirement. But I am not able to compile it.