finding error


please help me out ...

Teacher will give him tomorrow :"(


: )













a)

template < class A >
int sum( int num1, int num2, int num3 )
{
return num1+ num2+ num3;
}




b)

void printResults( int x, int y )
{
cout << "The sum is " << x + y << '\n';
return x + y;
}




c)

template <A>
A product(A num1, A num2, A num3 )
{
return num1 * num2 * num3;
}




d)

double cube( int );
int cube( int );
I'm not going to do your homework for you, but I can give you some clues:

a) Think about what a template is. What's the point of it? How is that template acheiving that?

b) You might need to have a think about return types here.

c) Think about how you define a template.

d) What do those things have in common? What do they have different from each other?
Last edited on
thank u very much bro ..

Topic archived. No new replies allowed.