-
What is the output of this program?
#include <iostream>
using namespace std;
template <class T>
inline T square(T p)
{
T result;
result = p * p;
return result;
};
template <>
string square<string>(string str)
{
return (str+str);
};
int main()
{
int k = 4, kk;
string bb("A");
kk = square<int>(k);
cout << k << kk;
cout << square<string>(bb) << endl;
}
-
- 164AA
- AA416
- 416AA
- All of above
- None of these
Correct Option: C
In this program, We are using two template to calculate the square and to find the addition.