Comment #0 by andrej.mitrovich — 2013-03-21T10:25:03Z
interface I
{
void foo(int count, int** ptr);
}
class C : I
{
void foo(int count, float** ptr) { }
}
void main()
{
}
$ dmd test.d
> (6): Error: class test.C interface function 'void foo(int count, int** ptr)' is not implemented
If there is a name match between an implementation method and an interface method, the diagnostic should list the implemented method as a partial match, and should probably show why it doesn't implement the interface method:
> (6): Error: class test.C interface function 'void foo(int count, int** ptr)' is not implemented
> (8): Partial match: 'void foo(int count, float** ptr)'
> (8): : Parameter #2: 'float**' does not match interface parameter 'int**'
Comment #1 by bearophile_hugs — 2013-03-21T11:48:07Z
This seems a nice idea.
Comment #2 by andrej.mitrovich — 2013-03-21T11:50:20Z
(In reply to comment #1)
> This seems a nice idea.
The same idea can be extended for overrides:
class B
{
void foo(int count, int** ptr) { }
}
class C : B
{
override void foo(int count, float** ptr) { }
}
Comment #3 by robert.schadek — 2024-12-13T18:05:05Z