Why is this legal?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 29 11:24:04 PDT 2017


On Wednesday, March 29, 2017 10:08:02 abad via Digitalmars-d-learn wrote:
> Related question, it seems that final methods are allowed in
> interfaces. Obviously you can't implement them anywhere, so is
> this also on purpose and on what rationale? :)

If the function is final, it can have an implementation.

interface I
{
    final bool foo() { return true; }
}

class C : I
{
}

void main()
{
}

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list