What does this mean????

This is what my Book Says:

Alternative Function Syntax

The C++ 11 introduces an alternative syntax for writing the function header. Here’s an example of
the power() function that you saw earlier defi ned using the alternative syntax:

auto power(double x, int n)-> double // Function header
{ // Function body starts here...
double result(1.0); // Result stored here
for(int i = 1; i <= n; i++)
result *= x;
return result;
} // ...and ends here 

This will work in exactly the same way as the previous version of the function. The return type of the function appears following the -> in the header. This is referred to as a trailing return type. The auto keyword at the beginning indicates to the compiler that the return type is determined later.

So why was it necessary to introduce the alternative syntax? Isn’t the old syntax good enough? The answer is no. In the next chapter you’ll learn about function templates, where situations can arise when you need to allow for the return type from a function to vary depending on the result of executing the body of the function. You can specify that with the old syntax. The alternative
function syntax does allow you to do that, as you’ll see in Chapter 6.

It clearly says that the old syntax allows you to do that so why do you need the new alternative syntax o.O. Is it just me or is this a mistake?

I suspect that's a typo and they meant the old syntax "can't".

Here's probably an example of what they were referring to, but it might be beyond your current knowledge if they book is holding off on it.
ok thats definitely beyond my current knowledge but thank you.
Topic archived. No new replies allowed.