Serializing the objects of a class
-
Hi, I have written a perfect Serializable class "X" with two variables and taken a dialog box with two editboxes. I am updating the information from dialog box into "X" variables and trying to serialize that class object. Where should I call X.Serialize(ar) ? Is it in Document class? If so, is it mandatory ? I have also tried to do by declaring a global variable"Xobj" in the document class and calling the Xobj.Serialize(ar) in the Document's Serialize(). However I am getting "error C2011: 'X' : 'class' type redefinition".Perhaps may be the header file is getting included twice, I guess. But when I am trying to resolve the problem, it has entered an infinite loop and things have become too worst. I have gone through many articles since yesterday on "Serializing the objects" where one serializable class is getting serialized in another Serializable class and so on. But my doubt is how and where will the root serializable class's Serialize() get called. Please some one help me on this topic. I am unable to proceed with my sample application. Any sample application could also help me. Thanks in advance.
Taruni
-
Hi, I have written a perfect Serializable class "X" with two variables and taken a dialog box with two editboxes. I am updating the information from dialog box into "X" variables and trying to serialize that class object. Where should I call X.Serialize(ar) ? Is it in Document class? If so, is it mandatory ? I have also tried to do by declaring a global variable"Xobj" in the document class and calling the Xobj.Serialize(ar) in the Document's Serialize(). However I am getting "error C2011: 'X' : 'class' type redefinition".Perhaps may be the header file is getting included twice, I guess. But when I am trying to resolve the problem, it has entered an infinite loop and things have become too worst. I have gone through many articles since yesterday on "Serializing the objects" where one serializable class is getting serialized in another Serializable class and so on. But my doubt is how and where will the root serializable class's Serialize() get called. Please some one help me on this topic. I am unable to proceed with my sample application. Any sample application could also help me. Thanks in advance.
Taruni
Typically it is done in the Document class (and in a standard SDI project, this is already done for you). This is the most logical place to put it because your document class is supposed to contain all data relevant for the application (but it can also contain other serializable classes). It is not mandatory but it is a bit akward not to have a serializable document.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++