//Main.h文件
#pragma once
#include<afxwin.h>class CEllipse :public CObject
{DECLARE_SERIAL(CEllipse)private:double m_point;
public:CEllipse(){}void Serialize(CArchive&);
};
//Main.cpp文件
#include"main.h"IMPLEMENT_SERIAL(CEllipse, CObject, 0);
void CEllipse::Serialize(CArchive &ar)
{if (ar.IsStoring())//判断是写入文件还是读出文件{//写入文件ar <<m_point;//若m_point为自己定义的类对象,则该类需要重载<<运算符和>>运算符。}else{//读出文件ar>>m_point;}
}int main()
{CEllipse e;return 0;
}