共用方式為


Deriving a Document Class from CDocument

Documents contain and manage your application's data. To use the MFC Application Wizard-supplied document class, you must do the following:

  • Derive a class from CDocument for each type of document.

  • Add member variables to store each document's data.

  • Override CDocument's Serialize member function in your document class. Serialize writes and reads the document's data to and from disk.

Other Document Functions Often Overridden

You may also want to override other CDocument member functions. In particular, you will often need to override OnNewDocument and OnOpenDocument to initialize the document's data members and DeleteContents to destroy dynamically allocated data. For information about overridable members, see class CDocument in the MFC Reference.

See Also

Concepts

Using Documents