private method in interface
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jun 2 12:20:00 PDT 2011
On 2011-06-02 12:01, Michael Shulman wrote:
> 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?
http://d.puremagic.com/issues/show_bug.cgi?id=4542
http://d.puremagic.com/issues/show_bug.cgi?id=2051
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list