Home Segments Index Top Previous Next

148: Mainline

The variables that appear inside class definitions—such as height, width, and length—are called member variables.

In other programming languages, member variables are called fields or slots. The virtue of such alternative terms is that they encourage you to think of class definitions as patterns and of class objects as filled-in patterns. Bowing to convention, however, this book uses the term member variable throughout.