Home Segments Index Top Previous Next

815: Mainline

Suppose, for example, that you define the Food class, with a setter and getter for the fCalories instance variable. Note that in these definitions, Food is a subclass of Model, rather than of Object, and that fCalories: sends a changed: message:

Food class definition 
Model subclass: #Food 
  instanceVariableNames: 'food fCalories cCalories pCalories' 
  classVariableNames: '' 
  poolDictionaries: '' 
  category: 'Experiment' 
Food method definition • instance 
  ^ fCalories 
Food method definition • instance 
fCalories: aNumber  
  fCalories := aNumber. 
  self changed: #fCalories