'final' function implementations in interface definition

Michel Fortin michel.fortin at michelf.com
Sun Jun 7 16:54:41 PDT 2009


On 2009-06-07 17:58:30 -0400, HOSOKAWA Kenchi <hskwk at inter7.jp> said:

> interface I
> {
> 	void f(int);
> 	final void f_twice(int i) { f(i); f(i); }
> }
> 
> class C : I {...}
> 
> (new C).f_twice(1);

If you don't mind about the syntactic difference:

interface I
{
	void f(int);
}

void f_twice(I a, int i) { a.f(i); a.f(i; }

class C : I {...}

f_twice(new C, 1);


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list