Given the following function template, select all valid calls to it.

icon
Related questions
Question
Given the following function template, select all valid calls to it.
template <class T>
T sum (T a, T b)
{
}
T result;
return a + b;
Code source: Overloads and templates E
std::string sum1 = sum<std::string>(10, 20);
int sum1 = sum(10, 20);
std::string sum1 = sum<std::string>("10", "20");
float sum1 = sum<float>(10.0, 20.0);
int sum1 = sum<int>(10, 20);
Transcribed Image Text:Given the following function template, select all valid calls to it. template <class T> T sum (T a, T b) { } T result; return a + b; Code source: Overloads and templates E std::string sum1 = sum<std::string>(10, 20); int sum1 = sum(10, 20); std::string sum1 = sum<std::string>("10", "20"); float sum1 = sum<float>(10.0, 20.0); int sum1 = sum<int>(10, 20);
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer