Home Segments Index Top Previous Next

340: Mainline

For example, the following revision of the Food class definition contains class variables for the ratios of calories to fat grams, to carbohydrate grams, and to protein grams:

Food class definition 
Object subclass: #Food 
  instanceVariableNames: 'fCalories cCalories pCalories' 
  classVariableNames: 'FatRatio CarbohydrateRatio ProteinRatio' 
  poolDictionaries: ''