Having trouble with objects.

Jarrod qwerty at ytre.wq
Tue Mar 18 16:15:58 PDT 2008


On Tue, 18 Mar 2008 12:00:29 -0400, Steven Schveighoffer wrote:
 
> Have you tried static opCall?  It's sort of like a struct constructor:
> 
> struct S
> {
>   int val;
>   static S opCall(int arg)
>   {
>       S retval;
>       retval.val = arg;
>       return retval;
>   }
> }
> 
> S func()
> {
>     return S(1);
> }
> 
> -Steve

Hey, that is actually really handy. I'll have to remember it.
Thanks Steve.


More information about the Digitalmars-d-learn mailing list