#include #include #include using namespace std; template< class T> void foo( T op1, T op2) { string foo; if (typeid( T) == typeid( foo)) { cout << "foo was called with a string" << endl; } cout << "op1 = " << op1 << endl; cout << "op2 = " << op2 << endl; } template<> void foo( int op1, int op2) { cout << "op1 = " << op1 << endl; cout << "op2 = " << op2 << endl; int product = op1 * op2; cout << "op1 * op2 = " << product << endl; } int main() { int i=1, j=17; string lhs("lhs"), rhs("rhs"); foo( i, j); foo( lhs, rhs); foo( 1.0, 3.14); return 0; }