Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-04-05 01:50:43


Ruediger Berlich wrote:
> Apologies - here is some info on the environment:
>
> I'm running OpenSUSE 10.2 with g++ 4.1.2 and Boost 1.33.1 .
>
> Thanks and Best Regards,
> Ruediger
>
>
> Ruediger Berlich wrote:
>
>> Hi there,
>> I am trying to serialize an object through a pointer to its base
>> class.
>>
>> My application is in the field of distributed processing. I have
>> a "communicator" type of class, which receives pointers from other
>> objects, serializes them, sends the generated string over a network
>> for further, remote processing and then deals with the responses. It
>> is supposed to know nothing about the objects it serializes, except
>> that they contain a method "toString()", which is contained in the
>> base class.
>>
>> However, when I call that method, I only get a serialization of that
>> base class, not of the derived class.

*this is not a pointer. Hence
        oa << make_nvp("myp",*this);

Does not serialize through a pointer to the base class. Try the following
instead:

        oa << make_nvp("myp",this);

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net