On 16/09/2016 3:07 AM, Ram_B wrote:
How i can get fields of derived classes in runtime? This not worksimport std.traits; import std.experimental.logger; class A { int a,b; this(){} void fields(){ log(FieldNameTuple!this); } } class B : A{ int c; this(){} } void main(){ B b = new B(); b.fields(); }
A few weeks ago I wrote an article for TWID that covers this very subject. Sadly because of a bug in dmd it doesn't work for all cases perfectly. http://arsdnet.net/this-week-in-d/2016-aug-28.html