Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Serializing the objects of a class

Serializing the objects of a class

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Taruni
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • T 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

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      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++

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups