std.serialization

Rory McGuire rjmcguire at gmail.com
Mon Feb 17 04:20:49 PST 2014


Interesting, do you have to run though all registered classes that are
sub-classes of the base class and cast them checking for null?


On Mon, Feb 17, 2014 at 9:24 AM, Jacob Carlborg <doob at me.com> wrote:

> On Monday, 17 February 2014 at 06:09:35 UTC, Rory McGuire wrote:
>
>  A base class reference is: from your example an A which actually contains
>> a
>> C or B.
>>
>> Honestly I haven't tried this I would have assumed that D still gives you
>> the real type when using reflection but have you tried it?
>>
>
> Unfortunately the only why to get a value of field by reflection requires
> the static type to be known. When serializing through a base class
> reference the static type is lost. Therefore it's required to register the
> subclass, one way or another.
>
> --
> /Jacob Carlborg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20140217/80c01c41/attachment-0001.html>


More information about the Digitalmars-d-announce mailing list