Help a C++ coder see the light

Neil Hodgson nhodgson at bigpond.net.au
Sat Feb 1 02:38:29 CET 2003


Alan Morgan:

> It's obvious.  You had the arguments to calculate_weekly_wage backwards.
>
> You should have written
>
>     printf(" -> wage (including overtime) is $%.2f.\n",
>    calculate_weekly_wage(rate, hours));

   No, it's obvious that there should be explicit Rate and TimeDelta classes
with well defined combining operators, no conversion operators, and an
operator- that takes a TimeDelta on the left hand side and a float on the
RHS. But no operator- for the other way around.

   Neil






More information about the Python-list mailing list