CArchive::WriteClass

void WriteClass( const CRuntimeClass* pClassRef );

Parameters

pClassRef

A pointer to the CRuntimeClass structure that corresponds to the class reference requested.

Remarks

Use WriteClass to store the version and class information of a base class during serialization of the derived class. WriteClass writes a reference to the CRuntimeClass for the base class to the CArchive. Use CArchive::ReadClass to retrieve the reference.

WriteClass verifies that the archived class information is compatible with your runtime class. If it is not compatible, WriteClass will throw a CArchiveException.

Your runtime class must use DECLARE_SERIAL and IMPLEMENT_SERIAL; otherwise, WriteClass will throw a CNotSupportedException.

You can use SerializeClass instead of WriteClass, which handles both reading and writing of the class reference.

CArchive OverviewClass MembersHierarchy Chart

See Also   CArchive::ReadClass, CArchive::GetObjectSchema, CArchive::SetObjectSchema, CArchive::SerializeClass, CArchiveException, CNotSupportedException.