C++ complier are very clever, it can auto try implict data types ( for plain old data );
Predict the output of the flowing codes:
#include <iostream>
using namespace std;
//get the larger of two values
template <class T>
T GetMax ( T a , T b){
return a > b ? a : b;
}
int main ()
{
int ia = 10;
int ib = 11;
//normal use
int iMax = GetMax<int> (ia, ib);
cout << iMax << endl;
//clean use
cout << GetMax(ia, ib) << endl;
getchar();
return 0;
}