aarya
asked on
Regarding Serialization ...
hello everybody
I am going through MFC tutorials (Scribble). There is one object declared
as follows :
CTypePtrList<CObList, CStroke *> m_strokeList;
The serialise function in CScribbleDoc is declared as follows :
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
m_strokeList.Serialize( ar );
And the serialise function for "CStroke" has been defined and implemented.
What i am unable to understand is that how does the serialise function
of "CStroke" is being called when i save the document.
What i understand is that m_strokeList.Serialise() calls the serialise
function of the base class "CObject". Now how does the base class knows
that the object being serialised is list of pointes which are to be
serialised one by one so that serialise function of CStroke is called
for all pointers in the m_strokeList.
The "DECLARE_SERIAL" and "IMPLEMENT_SERIAL" macros are present in CStroke.
I am going through MFC tutorials (Scribble). There is one object declared
as follows :
CTypePtrList<CObList, CStroke *> m_strokeList;
The serialise function in CScribbleDoc is declared as follows :
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
m_strokeList.Serialize( ar );
And the serialise function for "CStroke" has been defined and implemented.
What i am unable to understand is that how does the serialise function
of "CStroke" is being called when i save the document.
What i understand is that m_strokeList.Serialise() calls the serialise
function of the base class "CObject". Now how does the base class knows
that the object being serialised is list of pointes which are to be
serialised one by one so that serialise function of CStroke is called
for all pointers in the m_strokeList.
The "DECLARE_SERIAL" and "IMPLEMENT_SERIAL" macros are present in CStroke.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If CObList had been overriding the serialize function then i can understand how they would have implemented but otherwise how can u take care.
Any nice to have response from u.
Thui it seems that u r point rich man. I have plenty of questions to ask but no points left. Can u do me a favor to lend few points.
Thanks in advance.