Interface inheritance
Mandeep Singh Brar
mandeep at brars.co.in
Sun Dec 12 02:48:42 PST 2010
I just posted a bug on the bugs list about problems in compiling the following code using dmd, but realized
that there might be some inheritance feature that i might now be aware of. Can you please let me know if i
am missing something in the below code.
import std.stdio;
interface A {
public void a(int l);
}
class ACl:A {
public void a(int l) {
writeln("Hello a");
}
}
interface B: A {
public void a(string l, int k);
}
class BCl: ACl, B {
public void a(string l, int k) {
writeln("Hello B.a", l, k);
}
}
int main() {
B b = new BCl();
b.a(1);
return 0;
}
However casting B to A like (cast(A)b).a(1); makes it work.
Mandeep
More information about the Digitalmars-d-learn
mailing list