You need to deal with the record structure in the traditional programming environment. Creates a "dumb" Data Object for this record.
Motivation: Record structures are the common nature of many programming environments. There are some reasons to bring them into object-orientedProgramMedium: You may face a legacy program, or you may need to use a traditional API to communicate with the record structure, or process records read from the database. In these cases, you need to create an interface class to process the external data. The simplest way is to first create a class that looks like an external record, so that some fields and functions can be moved to this class in the future. An uncommon but notable case is that the elements at each position in the array have a specific meaning. In this case, replace array with object (replacing the array with an object) should be used ).
Practice: 1. Create a class to indicate this record.
2, Corresponding to each item of data in the record, create a corresponding private field in the new class. And provide the corresponding value/set value function.
Now, you have a "dumb" Data Object. This object does not have any useful behavior yet, but further refactoring will solve this problem.