What's wrong with this code....
//templates
#include<iostream>
using namespace std;
template <class t>
t max (t w,t x) --->here i get no error if I use &w and &x in place of w and x...{
if(w>x)
return w;
else
if(w!=x)
return x;
}
int main()
{
int a=10,b=343,c;
c=max(a,b);
cout<<"Max="<<c;
float d=2.99,e=3.4,f;
f=max(d,e);
cout<<"\nMax="<<f;
system("pause");
return 0;
}
compiler gives an error:: call of overloaded `max(int&, int&)' is ambiguous