myClass.add(something)(otherthings)(thisToo);

Ellery Newcomer ellery-newcomer at utulsa.edu
Tue Dec 9 15:49:26 PST 2008


tsalm wrote:
> Hello,
> 
> How to implement an object that can do this :
> myClass.add(something)(otherthings)(thisToo);
> 
> Is it possible ?
> 
> TIA,
> TSalm

Something like this might work:

class MyClass{
    int[] stuff;
    alias add opCall;
    MyClass add(int k){
       stuff ~= k;
       return this;
    }
}


More information about the Digitalmars-d-learn mailing list