The method return type is bool
is the important point here.
The primary aim of C++ is evaluating expressions and in
return (expression1,expression2);
You have two expressions namely expression1
and expression2
which are evaluated one after the other ( the comma - which is just a separator - does this bit ).
Since expression2
comes last, whatever value it is evaluated to is returned. If expression2
returns a non-zero value the returned value will be true
and if not false
.
Sidenote: Though ,
can be overloaded it is pretty clear from the question that you're using it just as a separator