reimplementing an interface in a derived class
kdevel
kdevel at vogtner.de
Thu Jan 3 22:30:48 UTC 2019
https://dlang.org/spec/interface.html #11 has this code example:
```
interface D
{
int foo();
}
class A : D
{
int foo() { return 1; }
}
class B : A, D
{
override int foo() { return 2; }
}
...
B b = new B();
b.foo(); // returns 2
D d = cast(D) b;
d.foo(); // returns 2
A a = cast(A) b;
D d2 = cast(D) a;
d2.foo(); // returns 2, even though it is A's D, not
B's D
```
What is the meaning of the ", D"? It does not seem to make a
difference if it is omitted.
More information about the Digitalmars-d-learn
mailing list