Overload a function template declaration. : Template Overload « Generic « C++






Overload a function template declaration.

Overload a function template declaration.


#include <iostream>
using namespace std;

template <class X> void f(X a)
{
  cout << "Inside f(X a)\n";
}

template <class X, class Y> void f(X a, Y b)
{
  cout << "Inside f(X a, Y b)\n";
}

int main()
{
  f(10);     
  f(10, 20); 

  return 0;
}

           
       








Related examples in the same category

1.Define template function for class typeDefine template function for class type
2.A generic version of myabs().A generic version of myabs().