Access private member

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 13 00:53:08 PDT 2016


On 2016-06-13 09:49, Jacob Carlborg wrote:

> For fields, used .tupleof, for other symbols, use a pointer.

Here's an example [1] of accessing a field using the name of the field 
as a string. It will bypass private.

That module [1] contains some generic functionality for working with 
fields which you would need for serialization. Or you can use the whole 
serialization library directly [2] ;)

[1] 
https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L123

[2] https://github.com/jacob-carlborg/orange

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list