Behavior and State

There is another, alternative way that we can divide the features of a class, orthogonal to the public/private distinction. A class can be divided into behavior and state. Behavior describes the actions that an instance can perform in response to a message request. Behavior is implemented by class methods. The state aspect of a class describes the data that an object must maintain in order to successfully fulfill its behavior. State is stored in instance variables. Instance variables are sometimes also known as data members, or data fields.

[audio] [real] Text to accompany slide05, in Chapter 4 of An Introduction to Object-Oriented Programming