You can set or get the Food
class
variables in any Food
class or instance method. For example, the
instance method, fGrams
, provides the number of fat grams in a
serving of food by dividing the number of fat calories in a serving of the
food (the value of an instance variable) by the ratio of fat grams to fat
calories (the value of a class variable):
Food method definition instance fGrams ^ fCalories / FatRatio