Home Segments Index Top Previous Next

203: Mainline

Note that a class definition, in contrast to a method definition, is expressed as a message sent to a class. The following diagram explains:

 *-- The Object class is the receiver of the message 
 | 
 |      *-- The first keyword in the message is subclass: 
 |      | 
 |      |         *-- The subclass to be defined is named Vegetable; 
 |      |         |   the # mark is explained in Segment••missing reference••
 v      v         v 
Object subclass: #Vegetable 

   *-- Second keyword    *--------*-- Single-quotation marks delimit 
   |                     |        |   instance variables 
   |                     |        *--------------------* 
   v                     v                             v 
  instanceVariableNames: 'fCalories cCalories pCalories' 

  classVariableNames: ''  <--*------- Other keywords and arguments, 
                             |        explained in Segment••missing reference••
  poolDictionaries: ''    <--*        and Segment••missing reference••