It is a C++ code, why line 3 has an error:
template struct sum used without template parameters
template<class T> void foo(T op1, T op2)
{
cout<< "op1 = " << op1 << endl;
cout<< "op2 = " << op2 << endl;
}
template<class T>
struct sum
{
static void foo(T op1 , T op2)
{
cout << "sum is " << op1 << endl;
}
};
int main()
{
foo(1,3); // line 1
foo<int>(1, '3'); // line 2
sum::foo(1,2); // line 3
return 0;
}
Line 1 has no template parameters, but it has no error.
Thanks !