Section 17.5 demonstrated how to write the individual fields of a
Record object to a text file, and Section 17.6 demonstrated how to read those fields from a file and place their values in a
Record object in memory. In the examples,
Record was used to aggregate the information for one record. When the instance variables for a
Record were output to a disk file, certain information was lost, such as the type of each value. For instance, if the value
"3" is read from a file, there’s no way to tell if the value came from an
string or a
decimal. We have only data, not type information, on disk. If the program that’s going to read this data “knows” what object type the data corresponds to, then the data can be read directly ...