why can't structs implement interfaces?

Saaa empty at needmail.com
Tue Nov 24 14:49:02 PST 2009


bearophile wrote:
> Moritz Warning:
>
>> If you only what a contract that certain functions are implemented,
>> then it just need to be implemented in the compiler frontend.
>
> In the meantime this can be done with a template mixin, where the template 
> statically asserts the presence of the functions/fields you want.
>
> Bye,
> bearophile

I wanted to do something like this:

class C : I {};
struct S : I {};
S s;
I[] i =[new C(), s ]; 




More information about the Digitalmars-d-learn mailing list