Boost logo

Boost Users :

Subject: Re: [Boost-users] Derived class is not serialising/de-serialising...
From: Marcus MacWilliam (marcus.macwilliam_at_[hidden])
Date: 2013-08-06 12:18:10


> At first I thought this was obvious. But now I look at this I would have
> thought it would work.
> I'm thinkinig it's related to the member function look up rules associated
> with virtual
> member functions. In any case, try the following:
>
> a) in BaseClass.h
> what();
> to
> what() = 0;
> This will detect any non-obvious copying (slicing) which might be occurring.
The what was added just for debugging purposes. Removal of all
what() still does not cause DeriveClass::serialize to be called.
>
> b) in InstantiableClass add a serialize function which only incudes only
> base object serialization.
If I did that, I would lose the data from the derived class. (m_com).
>
> c) tweak your main test program so that it doesn't use InstantiableClass
> but rather DerivedClass directly. Does that work?
It needs to use the InstantiableClass, cannot use the DerivedClass directly.
This is cut down code from our application, with a single example of the
relationship. The classes are not called by those names IRL.

Instead there are several classes that are sub-classes of BaseClass, and
several classes that are sub-classes of DerivedClass.
>
> Robert Ramey
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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