auto attribute for interface functions
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Tue Oct 8 22:21:19 PDT 2013
On Tuesday, 8 October 2013 at 13:40:47 UTC, Roman wrote:
> ```
> interface I
> {
> //auto foo(int i); //forbidden
>
> auto bar(T)(T i); //Error: function a.I.bar!(int).bar has no
> function body with return type inference
> }
Basically the error on the template answers your statement, bar
has no implementation so the compiler can't decide what the
return type should be.
Similarly a template can't be overridden since it doesn't exist
until you use it. What you can do is make final templates which
aren't ever inherited but can forward to functions which can be
inherited[1].
1. http://3d.benjamin-thaut.de/?p=94
More information about the Digitalmars-d-learn
mailing list