cppack icon indicating copy to clipboard operation
cppack copied to clipboard

Request: Please provide an example that packs and unpacks a derived class

Open quazar0 opened this issue 2 years ago • 0 comments

Could you please add an example that will pack and unpack a derived class, similar to this class C (which is derived from class P). And include the proper pack() method in each class.

class C: public P
{
public:
   string sName;

   template< class T >
   void pack( T &pack ) {
      pack( sName, ??? );
   }

}

class P
{
public:
   int uid;

   template< class T >
   void pack( T &pack ) {
      pack( uid );
   }
}

And maybe more importantly, the example should include an example where class C is derived from a std class (e.g. std::map).

Thank you.

quazar0 avatar Apr 30 '23 22:04 quazar0