https://issues.dlang.org/show_bug.cgi?id=12791

--- Comment #3 from [email protected] ---
ok, sorry, indeed __traits can do it. I know this may be out of place here but
might still be useful for people landing on this page:

-----------
auto b = new B; // B inherits from A
foreach(i, m; __traits(allMembers, B))
    static if (__traits(compiles, to!string(__traits(getMember, b, m))))
        writeln(m, " = ", __traits(getMember, b, m));
-----------

prints 'name = value' for all the fields (inherited or new, static or not,
etc.) of an instance of class B.

--

Reply via email to