Home Segments Index Top Previous Next

196: Mainline

When you define a class, you tell Smalltalk about instance variables, which are variables that describe the instances of the class.

Thus, in the following diagram, the Vegetable class description contains instance variable names, whereas the descriptions of particular Vegetable instances contain instance variable values.

*----------------------------------------* 
| Names of variables:                    |  <-- Description of 
|   fCalories                            |      Vegetable 
|   cCalories                            |      class 
|   pCalories                            | 
*----------------------------------------* 
  |                          | 
  | Instance                 | Instance         
  v                          v 
*---------------------*  *---------------------*   
| fCalories    3      |  | fCalories    0      |  <-- Descriptions of   
| cCalories   16      |  | cCalories   23      |      Vegetable 
| pCalories    9      |  | pCalories    4      |      instances 
*---------------------*  *---------------------*