still confused about call by reference

Nathan Reed nathaniel.reed at gmail.com
Tue Oct 30 10:36:56 PDT 2007


Hoenir wrote:
>> I think the opCall needs to be declared static.
>>
> opCall is used here as a "constructor" for that struct. Thus declaring 
> it static doesn't make any sense to me. Are you sure it must be static?

Right, it's used as a constructor.  That's the point: it has to be 
callable without having an instance of the struct laying around - hence 
static.

With a non-static opCall, you can use an instance of the struct as a 
callable entity. Static opCall lets you use the name of the struct 
itself as a callable entity.

Thanks,
Nathan Reed


More information about the Digitalmars-d-learn mailing list