On 2013-07-19 00:47, JS wrote:
module main;
import std.stdio;

interface A
{
     final void Afoo() { }
     void bar();
}

class B  : A
{
     final void Bfoo() { }
     void bar() { }
     void doo() { }
}

class C : B
{
     //override void bar() { }
     override void doo() { }
         void doo(int x) { }
}

int main(string[] argv)
{

     pragma(msg, GetOverloadedMethods!B);
     pragma(msg, GetOverloadedMethods!C);

    return 0;
}

GetOverloadedMethods comes from std.traits. It returns toHash, toString,
opCmp, etc...

tuple(bar, doo, toString, toHash, opCmp, opEquals)
tuple(doo, doo, bar, toString, toHash, opCmp, opEquals)

Is there a way to get only the overridden implemented methods?

GetOverloadedMethods!B gives only bar and doo
GetOverloadedMethods!B gives only doo and doo

I would guess it would be possible to get this information using the __traits derivedMembers, parent and getOverloads. Something like:

1. Get all derived members of the class
2. Get all derived members of the parent class
3. Create a tuple with the intersection of the above two lists
4. Filter out any methods that doesn't have the same arguments using getOverloads

Would that work? I guess it would be easier if we had a trait for that.

--
/Jacob Carlborg

Reply via email to