If this is what your want to do I think you would be better off with
 
lass Base {
    ...
    virtual ..
}
class D1 : public Base {
}


Base* bp1 = new D1(..some thing..);
Base* bp2;

ar << bp1;
ar >> bp2;
 
this might require registration or export though.
 
Robert Ramey

"Andrei Popa" <andrei4popa@hotmail.com> wrote in message news:BAY103-W307EA1D4D6FF4BE9CAB5C7E0FF0@phx.gbl...
Robert Ramey wrote:
> Oh, that should be easy:

> D1 *d1p;

> ar << d1;
> ar >> *d1p;

> Robert Ramey


Hi,

At
>     ar << d1;
>     ar >> bp; // but "bp" points already to an object of type D1

I meant : "bp" is "Base* bp"
So, if I call ar >> *bp; the Base::load will be called, not the derived D1:load.


Actually more precisely, I intend to do so

lass Base {
...
virtual ..
}

class D1 : public Base {
}


Base* bp1 = new D1(..some thing..);
Base* bp2 = new D1(..some thing else..);

ar << *bp1;
ar >> *bp2;

This means for all my serializable classes I have a kind of "=" operator defined.

regards,
Andrei


Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! Try it!


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users