![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The defect of the definition of tCalories
, as presented, is that, if
you decide to use instance variables for gram content—fGrams
,
cGrams
, and pGrams
—instead of for calorie content, then you
have to rewrite the tCalories
definition, and perhaps many others,
to use the new instance variables:
Food method definition • instance tCalories ^ fGrams * 9 + cGrams * 4 + pGrams * 4