Home Segments Index Top Previous Next

89: Mainline

To define the new fatToCalories method, you enter the following in the lower half of the class-hierarchy browser:

fatToCalories 
  "Answer the calories in the receiver, viewed as grams of fat" 
  ^ self * 9 

You can enter the method definition by replacing portions of the template provided by Smalltalk; alternatively, you can replace the template as a whole.