Re: typeof on protected field

2018-06-17 Thread DigitalDesigns via Digitalmars-d-learn
On Sunday, 17 June 2018 at 02:29:12 UTC, Adam D. Ruppe wrote: On Saturday, 16 June 2018 at 08:32:38 UTC, DigitalDesigns wrote: I need to get the protected and private members for serialization. This breaks encapsulation. A better design would be to have a class know how to serialize itself

Re: typeof on protected field

2018-06-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 16 June 2018 at 08:32:38 UTC, DigitalDesigns wrote: I need to get the protected and private members for serialization. This breaks encapsulation. A better design would be to have a class know how to serialize itself via a serializable interface.

Re: typeof on protected field

2018-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 16, 2018 13:12:13 bauss via Digitalmars-d-learn wrote: > On Saturday, 16 June 2018 at 08:32:38 UTC, DigitalDesigns wrote: > > mixin(`foo!(typeof(T.`~m~`)); > > > > gives me an error about m being protected. > > > > Error: class `X` member `name` is not accessible. > > > > this

Re: typeof on protected field

2018-06-16 Thread bauss via Digitalmars-d-learn
On Saturday, 16 June 2018 at 08:32:38 UTC, DigitalDesigns wrote: mixin(`foo!(typeof(T.`~m~`)); gives me an error about m being protected. Error: class `X` member `name` is not accessible. this also happens when using __traits(getMember, T, m); X is in another module. Works fine when X is in

typeof on protected field

2018-06-16 Thread DigitalDesigns via Digitalmars-d-learn
mixin(`foo!(typeof(T.`~m~`)); gives me an error about m being protected. Error: class `X` member `name` is not accessible. this also happens when using __traits(getMember, T, m); X is in another module. Works fine when X is in the same module. I need to get the protected and private members