look at this example:
Code:
//somewhere in the code
int a = 100, b = 99;
bool result;
result = a > b;
The above code initializes result to 1. Exactly,the same happens in your Compare function's return statement.
Remember that every comparison in your code is replaced by true or false (boolean values).After the expression
this->Volume() > xBox.Volume() evaluated, the value true or false sits instead of the expression.And then the true/false is implicitly converted to an integer corresponding true/false (that is 1/0) when returned by the function.
So your function's return statement changes to one of these :
or
Hope this short post helped;