Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CList serialization

Status
Not open for further replies.

Celetron

Programmer
Sep 18, 2002
4
GR
I am trying to serialize a class. Some of the data they have to be stored are contained in a CList. I have tried to serialize the class following the common way with no luck so far. I have also tried to use pointers to CList but even that didn't work. Can anyone help me on that? the code i use look like that:

// h file

class CMemberData : public CObject
{
DECLARE_SERIAL( CMemberData )

protected:
CList<myMEMBER, myMEMBER&>* Members;

public:
CMemberData();
~CMemberData();
virtual void Serialize( CArchive& ar );
};



// ccp file

IMPLEMENT_SERIAL(CMemberData,CObject,1)


CMemberData::CMemberData() : Members(NULL)
{
Members = new CList<myMEMBER, myMEMBER&>;
}

CMemberData::~CMemberData()
{
if (Members) delete Members;
}

void CMemberData::Serialize(CArchive& ar)
{
CObject::Serialize( ar );


if (ar.IsStoring())
{
ar << Members;
}
else
{
ar >> Members;
}

}


many thanks in advance

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top