![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Of course, you can also define methods for
the Food
class that are not setters and getters. For example,
tCalories
uses the fCalories
, cCalories
, and
fCalories
instance variables to compute the total number of calories
in a serving of a particular food:
Food method definition instance tCalories ^ fCalories + cCalories + pCalories