ghi trong mảng đó là kỷ lục 0. Một khi bạn thiết lập các điểm đánh dấu vị trí hiện tại, bạn có thể trả về một con trỏ đến bản ghi cuối cùng trong mảng. Để thêm chức năng này để ứng dụng mẫu của bạn, thêm một chức năng thành viên mới vào lớp tài liệu | Saving and Restoring Work File Access 301 I record in the array is record 0. Once you set the current position marker you can return a pointer to the last record in the array. To add this function to your sample application add a new member function to the document class. Specify the function type as CPerson a pointer to the custom class the function name as GetLastRecord and the access as public. Edit the function adding the code in Listing . Listing . The FUNCTION. 1 CPerson CSerializeDoc GetLastRecord 2 3 Are there any records in the array 4 if 0 5 6 Move to the last position in the array 7 m_iCurPosition - 1 8 Return the record in this position 9 return CPerson m_oaPeople m_iCurPosition 10 11 else 12 No records return NULL 13 return NULL 14 Serializing the Record Set When filling in the Serialize functionality in the document class there s little to do other than pass the CArchive object to the object array s Serialize function just as you did on Day 10. When reading data from the archive the object array will query the CArchive object to determine what object type it needs to create and how many it needs to create. The object array will then create each object in the array and call its Serialize function passing the CArchive object to each in turn. This enables the objects in the object array to read their own variable values from the CArchive object in the same order that they were written. When writing data to the file archive the object array will call each object s Serialize function in order passing the CArchive object just as when reading from the archive . This allows each object in the array to write its own variables into the archive as necessary. For the sample application edit the document class s Serialize function to pass the CArchive object to the object array s Serialize function as in Listing . 13 I 302 Day 13 Listing . The FUNCTION. 1