On Thursday, 15 September 2016 at 15:07:09 UTC, Ram_B wrote:
How i can get fields of derived classes in runtime? This not works
What about something like this: import std.traits; import std.stdio; class A { int a,b; this(){} void fields(this T)(){ writeln(FieldNameTuple!(T)); foreach(Class; TransitiveBaseTypeTuple!(T)) { writeln(FieldNameTuple!(Class)); } } } class B : A{ int c; this(){} } class C : B{ int d; this(){} } void main(){ C c = new C(); c.fields(); }