On Thursday, 21 July 2016 at 09:41:27 UTC, Saurabh Das wrote:
I have an interface A which declares a certain function. A
second interface B inherits from A and wishes to provide a
default implementation for that function. How can I achieve
this? I'm facing an error when I try this:
interface A
{
int func(int);
}
interface B : A
{
final int func(int)
{
return 0;
}
}
class C : B
{
}
rdmd it.d:
it.d(14): Error: class it.C interface function 'int func(int)'
is not implemented
Thanks,
Saurabh
Interesting.
This is worth a bugzilla issue, IMHO. In fact, if you try the
other way (i.e.: you provide an implementation of func in class
C), you get the opposite error, that you are overriding a final
function (B.func).