RR地问一下可串行化类的编写.........
第一次写一个可串行化类,从CObject继承
但是报一个错告诉我没有复制构造函数
我给他一个复制构造函数以后他报给我没有"="重载的一个错
我给他实现以后就却报了十多个"00XX函数在TEST.OBJ中已定义"什么的
代码如下:
class GridStruct:public CObject {
DECLARE_SERIAL(GridStruct)
public:
GridStruct(){}
GridStruct(CPoint ptA,CPoint ptB,int Shape){
ptStart = ptA;
ptEnd = ptB;
m_Shape=Shape;
}
/*GridStruct( const GridStruct &s ) // copy ctor拷贝函数
{
ptStart = s.ptStart;
ptEnd = s.ptStart;
m_Shape=s.m_Shape;}
GridStruct& operator=( const GridStruct &s ) // assignment operator运算符
{
ptStart = s.ptStart;
ptEnd = s.ptStart;
m_Shape=s.m_Shape;
return *this;}*/
void Serialize(CArchive& ar);
CPoint ptStart;
CPoint ptEnd;
int m_Shape;
};
void GridStruct::Serialize(CArchive& ar)
{
CObject::Serialize(ar);
if(ar.IsStoring())
ar<<m_Shape<<ptStart<<ptEnd;
else
ar>>m_Shape>>ptStart>>ptEnd;
}
还有想问问IMPLEMENT_SERIAL(GridStruct,CObject,1) 应该放在哪里?什么叫做实现类的过程算是哪里?