Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CObject::Serialize
CObject                                     Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  virtual void Serialize( CArchive& ar )
  throw( CMemoryException, CArchiveException, CFileException );
 
  Parameter   Description
 
  <ar>        A CArchive object to serialize to or from.
 
  Remarks
 
  Serialize reads or writes this object from or to an archive.
 
  You must override Serialize for each class that you intend to serialize.
  The overridden Serialize must first call the Serialize function of its
  base class.
 
  You must also use the DECLARE_SERIAL macro in your class declaration,
  and you must use the IMPLEMENT_SERIAL macro in the implementation.
 
  Use CArchive::IsLoading or CArchive::IsStoring to determine whether
  the archive is loading or storing.
 
  Serialize is called by CArchive::ReadObject and
  CArchive::WriteObject. These functions are associated with the
  CArchive insertion operator (<<) and extraction operator (>>).
 
  For serialization examples, refer to both the cookbook and the tutorial
  in the <Class Libraries User's Guide>.
 
  Example
 
     void CAge::Serialize( CArchive& ar )
  {
         CObject::Serialize( ar );
      if( ar.IsStoring() )
             ar << m_years;
      else
             ar >> m_years;
  }
 
 
 
                                     -♦-