dynamic classes and duck typing

Walter Bright newshound1 at digitalmars.com
Mon Nov 30 13:00:23 PST 2009


Álvaro Castro-Castilla wrote:
> It does. Shouldn't this work also?
> 
> struct foo {
>     void opDispatch( string name, T... )( T values ) { 
>     }   
> }
>                                                                                                                                        
> void main( ) { 
>     foo f;
>     f.bar( 3.14 );
> }

Declare as:

     void opDispatch(string name, T...)(T values...)
                                                ^^^



More information about the Digitalmars-d mailing list