Skip to content

Instantly share code, notes, and snippets.

@Jack2
Created November 19, 2012 16:14
Show Gist options
  • Save Jack2/4111542 to your computer and use it in GitHub Desktop.
Save Jack2/4111542 to your computer and use it in GitHub Desktop.
[C++]template_example
#include <iostream>
using namespace std;
template <typename T>
T Add(T a, T b)
{
return a+b;
}
int main()
{
cout << Add(1,1) << endl;
cout << Add(2.2, 2.2) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment