// Example program : maximum, using templates #include // for cout // Two-argument version: template const Tp& max(const Tp& a, const Tp& b){ return (b const Tp& max(const Tp& a, const Tp& b, const Tp& c){ return ::max(a, ::max(b, c)); } int main(){ using namespace std; cout << max(1, 3, 5) << endl; // the integer 5 cout << max(1.11, 3.33, 5.55) << endl; // the double 5.55 }