Home Segments Top Top Previous Next

165: Mainline

The variables that appear in particular class instances are called instance variables, as distinguished from class variables. There are as many sets of instance variables as there are class instances belonging to a class; there is just one set of class variables for an entire class.

Thus, in the following diagram, the Movie class definition contains descriptions of instance variables, whereas the descriptions of particular Movie instances contain instance-variable values:

*-----------------------------------------------* 
| Description of instance variables,            |  <-- Definition of 
|   for example, script, acting, and direction  |      the movie class 
*-----------------------------------------------* 
  
*-------------*  *-------------*  *-------------*   
| script 8    |  | script 8    |  | script 6    |  <-- Particular 
| acting 9    |  | acting   4  |  | acting   9  |      movie instances 
| direction 6 |  | direction 6 |  | direction 5 |       
*-------------*  *-------------*  *-------------*