On Wed, Mar 29, 2017 at 11:24:04AM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > 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. [...]
If a function is final, it *must* have an implementation, since there can be no further overrides that would provide one in a derived type. The rationale for allowing final methods in an interface is to provide users of the interface with nice syntactic sugar, e.g., a set of methods that are commonly used together abstracted into a single final method, while requiring subclasses to only implement a smaller number of orthogonal methods that can be used to implement that method. T -- When solving a problem, take care that you do not become part of the problem.