CHAPTER 20 FILE I/O AND OBJECT SERIALIZATION
Public Fields, Private Fields, and Public Properties
Notice that in each of these classes, you define the field data as public; this helps keep the example
simple. Of course, private data exposed using public properties would be preferable from an OO point of
view. Also, for the sake of simplicity, this example does not define any custom constructors on these
types; therefore, all unassigned field data will receive the expected default values.
OO design principles aside, you might wonder how the various formatters expect a type’s field data
to be defined in order to be serialized into a stream. The answer is that it de