digitalmars.D - Interfaces inheritance: to what extent is this behavior correct?
- Denis Feklushkin (20/20) Mar 01 Anonymous class declaration:
- Nick Treleaven (3/6) Mar 01 Yes, it should be a compiler error. See:
Anonymous class declaration:
```d
import std.stdio;
interface Foo1 {
final void print(){ writeln("Foo1"); }
}
interface Foo2 {
final void print(){ writeln("Foo2"); }
}
void main()
{
auto boo = new class Foo1, Foo2 {};
boo.print; // prints "Foo1"
}
```
Compiles and runs without errors.
But I think, if all interfaces are "equal", which means there
should be a compilation error. because compiler don't know which
of the two options should be used
Could anyone clarify: this is compiler issue or correct behaviour?
Mar 01
On Sunday, 1 March 2026 at 16:10:58 UTC, Denis Feklushkin wrote:But I think, if all interfaces are "equal", which means there should be a compilation error. because compiler don't know which of the two options should be usedYes, it should be a compiler error. See: https://github.com/dlang/dmd/issues/18278
Mar 01








Nick Treleaven <nick geany.org>