29.1. Serialization summary

Here’s a summary of how to serialize the data in a CDocument class.

  • Use the Resource Editor to change the document string to use a distinctive file extension for your files.

  • If your document has any data members that are instances of a class cMyClass which you wrote, define the cMyClass as a child of CObject (or as a child of some other class which inherits from CObject ) and add the DECLARE_SERIAL and IMPLEMENT_SERIAL macros to, respectively, the cMyClass definition in the *.h file and the cMyClass implementation in the *.cpp file.

  • Override the cMyClass::Serialize(CArchive &ar) method so that it writes and reads the data members of cMyClass, according to whether or not ar.IsStoring() is TRUE. Be sure to write and read ...

Get Software Engineering and Computer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.