Abstract Classes vs Interfaces

Jonathan M Davis jmdavisprog at gmail.com
Wed Jul 7 10:36:16 PDT 2010


> Consider the following:
> 
> interface A { final void foobar() { writeln("A"); } }
> interface B { final void foobar() { writeln("B"); } }
> 
> class C : A, B {}
> 
> void main(string[] args) {
> 
>      C c = new C;
>      c.foobar;
> 
> }
> 
> What does foobar print?
> (This has been filed as bug 4435:
> http://d.puremagic.com/issues/show_bug.cgi?id=4435)

I believe that per TDPL, you would have to call these with eithe c.A.foobar() or 
c.B.foobar() but that c.foobar() is not allowed. If it is allowed at present, 
it's definitely a bug. However, it's a bug in the implementation rather than the 
language spec.

- Jonathan M Davis


More information about the Digitalmars-d mailing list