Declaring interfaces with a constructor

David Zhang via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 14 06:54:41 PDT 2017


On Tuesday, 14 March 2017 at 02:14:53 UTC, evilrat wrote:
> like this?
> --------------------------------------
> [snip]
> -----------------------------------------
>
> there is also way to do this using templates and duck typing, I 
> think it will be more idiomatic way since ranges and stuff 
> heavily use it to provide such generalism, though just like you 
> say, I would prefer to have strict interface for such use 
> case...

Yeah, that's the idea. Though I just thought of a possibility 
using an isPublicInterface template. Is that what you meant by 
templates and duck typing?


More information about the Digitalmars-d-learn mailing list