private method in interface
Michael Shulman
viritrilbia at gmail.com
Thu Jun 2 12:01:31 PDT 2011
On Thu, Jun 2, 2011 at 10:31 AM, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
> Private methods are non-virtual, so I'm pretty sure they are not supposed to
> be allowed in an interface.
>
> But I suppose private could also mean private final, in which case you have
> to provide an implementation for foo in the interface.
In section 6.9.1 of "The D Programming Language" about Non-Virtual
Interfaces, there is an example (p214) of an interface which defines
two private methods without implementation. But now that you point it
out, that code also fails the linker for me. Is that book out of sync with
the implementation?
> This would be in line with the error message.
It is true that if I replace "private" with "final" I get the same
error message. That is also puzzling to me; I would expect a final
method in an interface without an implementation to be a *compiler*
error, since there is no way anyone else can implement it. Is there?
Mike
More information about the Digitalmars-d-learn
mailing list