dimanche 28 mai 2017

Serialize and deserialize objects in C ++

I'm new to C ++, I can not find a detailed example of how to serialize an object in binary so I can save it to the mysql server and then be deserialized.

The object looks like this:

class home{
        public:
          int houseNumber;
          bool isEmpty;
          Dweller *dweller;
};
     class Dweller{
       public:
         int phoneNumber;
         bool man;
         Backpack backpack;
};
     class Backpack{
      public:
        int item1;
        int item2;
        int item3;
        int item4;
        float weight;
        bool empty;
};

I have to serialize the house object, which owns the other objects.

Aucun commentaire:

Enregistrer un commentaire