// template_function.cc #include using namespace std; template T Square(const T& y) { T ySquared = y * y; // * operator must exist for type T return (ySquared); } int main() { int p = 2; int pSquared = Square(p); cout << p << " squared = " << pSquared << endl; double q = 0.5; double qSquared = Square(q); cout << q << " squared = " << qSquared << endl; }