xxxxxxxxxx
class Generic(alias pred)
{
void add(int a, int b)
{
import std.stdio : writeln;
if (pred(a,b))
writeln(a);
else
writeln(b);
}
}
class Custom
{
alias MyGeneric = Generic!( (a,b) => less(a,b) );
private MyGeneric g;
this ()
{
g = new MyGeneric;
}
void test()
{
}
bool less(int a, int b)
{
import std.stdio : writeln;
writeln("Yup");
return a < b;
}
}
void main()
{
auto t = new Custom;
t.test;
}