'final' function implementations in interface definition

Ary Borenszweig ary at esperanto.org.ar
Sun Jun 7 17:48:57 PDT 2009


HOSOKAWA Kenchi escribió:
> Hello,
> 
> 
> Interface member functions do not have implementations. 
> This specification prevents to implement macro-like small functions which won't be overridden.
> It seems that interfaces are possible to have function implementations if the function is ensured not to be overridden.

What about this?

interface A {
   void foo();
   final int fun() { return 1; }
}

interface B {
   void bar();
   final int fun() { return 2; }
}

class C : B, A {
}

(new C).fun();

What does that do?

I think this has the same problems as multiple inheritance.



More information about the Digitalmars-d mailing list