Satisfying interface requirements

BCS ao at pathlink.com
Thu Jul 26 13:31:44 PDT 2007


Reply to Jason,

> Attached is a simple example that demonstrates my problem (with dmd
> 1.018).  It seems like inheriting from a class that contains functions
> that would satisfy an interface does not work.  Usually, I work around
> this by just adding a manual call to super's copy.  Unfortunately,
> this only works if super's member function is not final.  Any tips on
> how to work around this?
> 
> If line 7 is commented out:
> test.d(6): class test.foo interface function bar.start is not
> implemented
> If line 7 is present:
> test.d(7): function test.foo.start cannot override final function
> tango.core.Thread.Thread.start

alias the functions (I think you can even change the name to make it match)


interface I {int foo();}

class C { int bar(){...} }

class D : C, I {alias bar foo;}




More information about the Digitalmars-d-learn mailing list