What will be the output of the following C++ code? [code] #include <iostream> #include <string> #include <cstdlib> using namespace std; template

Ngân Lam

New member
What will be the output of the following C++ code?
Code:
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
T func(T a)
{
	cout<<a;
	return a;
}
template<class U>
void func(U a)
{
	cout<<a;
}
int main(int argc, char const *argv[])
{
	int a = 5;
	int b = func(a);
	return 0;
}
A. 5
B. 55
C. Error
D. Segmentation fault
 

Tìm kiếm

Back
Top