
12 Apr
2011
12 Apr
'11
11:53 a.m.
Jerry wrote:
Thanks Robert. You mis-understood my intention. What we want is to serilaize an derived type object directly (not throught base type pointer) but deserialize it to a base type pointer. So we want the exactly the following codes:
I think Robert understands. The serialization library relies on the types saved to an archive be equal to the types being loaded from that archive.
Derived d; oa << d;
Requires: Derived d; ia >> d; If you do: Derived* d; // note pointer oa << (Base*)d The you can:
Base* b; ia >> b;
HTH, Jeff