Function Templates

#include < iostream.h >
#include < conio.h >
template < class T >
T max(T a,T b)
  {
  return a>b?a:b;
  }
void main()
   {
   clrscr();
   cout << "\n\n " << "max(10,15)= " << max(10,15) << endl;
   cout << "\n\n " << "max('k','s')= " << max('k','s') << endl;
   cout << "\n\n " << "max(10.1,15.1)= " << max(10.1,15.1) << endl;

   getch ();
   }
   
<< Go Back

Our aim is to provide information to the knowledge seekers. 


comments powered by Disqus




Footer1