이 항목은 아직 평가되지 않았습니다.이 항목 평가

DECLARE_SERIAL

Generates the C++ header code necessary for a CObject-derived class that can be serialized.

DECLARE_SERIAL(class_name )
class_name

The actual name of the class.

Serialization is the process of writing or reading the contents of an object to and from a file.

Use the DECLARE_SERIAL macro in an .h module, and then include that module in all .cpp modules that need access to objects of this class.

If DECLARE_SERIAL is included in the class declaration, then IMPLEMENT_SERIAL must be included in the class implementation.

The DECLARE_SERIAL macro includes all the functionality of DECLARE_DYNAMIC and DECLARE_DYNCREATE.

You can use the AFX_API macro to automatically export the CArchive extraction operator for classes that use the DECLARE_SERIAL and IMPLEMENT_SERIAL macros. Bracket the class declarations (located in the .h file) with the following code:


#undef AFX_API
#define AFX_API AFX_EXT_CLASS

// <your class declarations here>

#undef AFX_API
#define AFX_API


For more information on the DECLARE_SERIAL macro, see CObject Class Topics.


class CAge : public CObject
{
public:
    void Serialize(CArchive& ar);
    DECLARE_SERIAL(CAge)

    // remainder of class declaration omitted


Header: afx.h

이 정보가 도움이 되었습니까?
(2000자 남음)
커뮤니티 콘텐츠 추가
Microsoft는 MSDN 웹 사이트에 대한 귀하의 의견을 이해하기 위해 온라인 설문 조사를 진행하고 있습니다. 참여하도록 선택하시면 MSDN 웹 사이트에서 나가실 때 온라인 설문 조사가 표시됩니다.

참여하시겠습니까?