Default implementations in inherited interfaces
Saurabh Das via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 21 02:41:27 PDT 2016
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
More information about the Digitalmars-d-learn
mailing list