D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 502 - reimplementing methods for interface
Summary: reimplementing methods for interface
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 normal
Assignee: Walter Bright
URL:
Keywords: rejects-valid, spec
: 1584 (view as issue list)
Depends on:
Blocks:
 
Reported: 2006-11-13 16:12 UTC by Frank Benoit
Modified: 2014-02-15 13:20 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Frank Benoit 2006-11-13 16:12:00 UTC
http://www.digitalmars.com/d/interface.html
A reimplemented interface must implement all the interface functions, it does not inherit them from a super class:

interface D{
    int foo();
}
class A : D{
    int foo() { return 1; }
}
class B : A, D{
    alias A.foo foo; // shouldn't this work for the reimplementation ???
}

in DMD 0.173 it doesn't.
Comment 1 Walter Bright 2006-11-26 02:33:36 UTC
This is as designed:

"A reimplemented interface must implement all the interface functions, it does not inherit them from a super class:"
Comment 2 Stewart Gordon 2006-11-26 03:08:00 UTC
The quotation says nothing about whether this is valid code.  It merely states _that_ a class that reimplements an interface must implement the interface functions, not _how_ it may or may not go about doing so.

Hence the comment,
    "shouldn't this work for the reimplementation ???"
i.e. shouldn't this be one way to go about implementing the interface functions?
Comment 3 Stewart Gordon 2007-11-08 08:10:04 UTC
Reopening per lack of response to my last comment, and considering that it's been brought up again.
Comment 4 Stewart Gordon 2007-11-08 08:11:05 UTC
*** Bug 1584 has been marked as a duplicate of this bug. ***
Comment 5 Walter Bright 2012-01-21 11:18:28 UTC
An alias is not an implementation.