/***************************************************************
* Name: Rafael Orta
* Course: Computer Science & Programming
* Class: CS04103 Section: 4 & 5
* Assignment Date: 04/15/18
* File Name: Live-Lect11-1.cpp
*****************************************************************
* ID: Live-Lect11-1
* Purpose: Example of the use of template functions
*****************************************************************/
#include <iostream>
#include <string>
using namespace std;
// Example using the Template Class.
template <typename T>
T addition(T x, T y)
{
return x + y;
}
int main()
{
int x = 20, y = 40, z;
float a = 5.25, b = 5.80, c;
string name = "Rafael", lName = " Orta", fName;
z = addition(x, y);
cout << "The Result of the addition is " << z << endl;
c = addition(a, b);
cout << "The Result of the addition is " << c << endl;
// The code below is an example of operator overloading using a template function
fName = addition(name, lName);
cout << "The Result of the addition is " << fName << endl;
return 0;
}