Constant Data Fields

Some languages allow the programmer to define a data field and declare it as constant, meaning it cannot be changed. Such values need not be hid behind an accessor, since they cannot be modified. For this reason such values are often declared as public.

There is a subtle distinction between a data field that cannot be reassigned, and a data field that cannot be changed in any fashion. Some languages provide for one, some provide for the other, some provide for neither.

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