I'm pretty sure you need to use "value.tupleof[i][0]" instead of "mm[0]" as well.

it does not work but I found a solution, that's what I do :

abstract class BaseClass
{
    uint[] a = [9, 10, 5];
}

override class Test : BaseClass
{
   int t = 0;
   string s = "holla";
}

public static JSONValue Serialize(BaseClass value)
{
    foreach(member; __traits(allMembers, typeof(value)))
    {
static if (__traits(compiles, to!string(__traits(getMember, value, member))))
       {
          auto result =  __traits(getMember, value, member);
static if(isArray!(typeof(value)) && !is(typeof(value) == string))
          {
                // process      
          }
else static if(is(typeof(value) == class) || is(typeof(value) == struct))
          {
               // process       
          }
          else
          {
              // process        
          }
     }
}

void main(string[] args)
{
   Serialize(new Test());
}

The problem is that I can not retrieve the variables from the parent class.

Reply via email to