I'm not all that familiar with policy classes but, if I understand what you are asking correctly, you can provide implementations in interfaces if the methods are final or static.

Is this the sort of thing you mean?

import std.stdio;

interface Foo
{
        final string foo()
        {
                return "foo";
        }
}

interface Bar
{
        final string bar()
        {
                return "bar";
        }
}

template IsInterface(T)
{
        enum IsInterface = is(T == interface);
}

class Policy(T, U) if(IsInterface!T && IsInterface!U) : T, U
{

}

alias Policy!(Foo, Bar) FooBar;

void main()
{
        auto fb = new FooBar();
        writeln(fb.foo(), " and ", fb.bar());
}

Reply via email to