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. MFC Serialization

MFC Serialization

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsonquestion
3 Posts 3 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.
  • N Offline
    N Offline
    Neha
    wrote on last edited by
    #1

    I have a class structure as follows: Class A: public CObject { } Class B: Public A { } Now I want to serialize pointer class B using CArchive. How can this be done? Regards

    S P 2 Replies Last reply
    0
    • N Neha

      I have a class structure as follows: Class A: public CObject { } Class B: Public A { } Now I want to serialize pointer class B using CArchive. How can this be done? Regards

      S Offline
      S Offline
      Selvam R
      wrote on last edited by
      #2

      Hi, http://www.codeproject.com/cpp/serialization_primer3.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_MFCNOTES_TN002.asp With Regards, R.Selvam

      1 Reply Last reply
      0
      • N Neha

        I have a class structure as follows: Class A: public CObject { } Class B: Public A { } Now I want to serialize pointer class B using CArchive. How can this be done? Regards

        P Offline
        P Offline
        Prakash Nadar
        wrote on last edited by
        #3

        in .h file

        class A : public CObject
        {
        public:
        DECLARE_SERIAL( A )
        // empty constructor is necessary
        A(){};

        void Serialize( CArchive& archive );
        

        };

        in .cpp file

        IMPLEMENT_SERIAL( A, CObject, 1 )
        void A::Serialize( CArchive& archive )
        {
        // call base class function first
        // base class is CObject in this case
        CObject::Serialize( archive );

        // now do the stuff for our specific class
        if( archive.IsStoring() )
             ///serialize it        
        else
            //deserialise it
        

        }

        Hope this code help you , for further reading MSDN has good explanation for serialization.


        1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time. 2.Why do people ask for time from people who are not wearing a wrist watch. Prakash, India.

        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