|
Boost Users : |
Subject: [Boost-users] [serialization] Polymorphism?
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-11-04 18:59:03
Hi,
I have a class named Bar which derives from a class named Foo. Both Foo and
Bar are serializable, and thus they both have the respective serialize()
functions. However, if I do the following, you will not get a polymorphic
call since you cannot have virtual template members in a class (The
serialize() function must be a template according to the Boost.Serialization
docs).
Foo* f = new Bar;
f->serialize();
Note that you wouldn't call serialize() directly like this, I'm simply doing
it to prove a point. At some point Boost.Serialization is going to want to
call the Serialize() function off of my Foo object, however it will not call
Bar::serialize() as I would expect since I cannot make serialize() virtual.
How would I provide polymorphic serialization of objects in
Boost.Serialization?
Thanks.
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