Why is this legal?
abad via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Mar 29 04:17:48 PDT 2017
On Wednesday, 29 March 2017 at 11:06:55 UTC, Petar Kirov
[ZombineDev] wrote:
> On Wednesday, 29 March 2017 at 10:12:08 UTC, abad wrote:
>> On Wednesday, 29 March 2017 at 10:08:02 UTC, abad 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? :)
>>
>> So actually it's just a question of not catching this mistake
>> early, because obviously compilation will fail when any class
>> tries to implement the interface so the end result is ok.
>>
>> Maybe it _could_ just disallow final methods altogether to
>> catch the errors earlier. But very minor detail overall.
>
> The idea between `final` functions in interfaces is to provide
> a default non-overridable implementation. For example:
>
Yes, does make sense. I was looking this from Java 7 perspective
where interfaces can't implement any methods.
More information about the Digitalmars-d-learn
mailing list