I'm having an issue with syntax and I was wondering if anyone could explain why the following code counts as a redefinition and doesn't work as expected?
int z;
template<class T>
void add(T x, T y) {
z = x + y;
}
add<int>(100, 50); // Error C2365
int main() {
cout << z << endl;
return 0;
}
Thanks