I know this is a C# forum but the C++ forum I have been to has some rude snobs on it. This is a code snippet from a project in one of my books on C++. The subject is function overloading. I understand completely the logic behind the first two functions. It makes sense to use a simple if-else statement. But in the third function, the author did it differently. And I can't figure out what it means:
I don't understand the return maximum(max(num1, num2)num3);
It's hard for me to read it also. What is happening in that final statement?
C#:
int maximum(int num1, int num2)
{
if(num1 > num2)
return num1;
else
return num2;
}
double maximum(double num1, double num2)
{
if(num1 > num2)
return num1;
else
return num2;
}
double maximum(double num1, double num2, double num3)
{
return maximum(max(num1, num2)num3);
}
I don't understand the return maximum(max(num1, num2)num3);
It's hard for me to read it also. What is happening in that final statement?