user defined implicit casts

Ender KaShae astrothayne at gmail.com
Thu Aug 2 08:37:39 PDT 2007


Jarrett Billingsley Wrote:


> Can you come up with something more solid than "this is how C++ does it?" 
> Can you explain what functionality global and static operator overloads 
> provide that member operator overloads cannot? 
> 
> 

lets say you have an immutable fraction class, with D the way it is you can't overload any op=, =, ++, or --, and maintain immutability
with nonmember/static operator overloads you can as such:

static Fraction opAddAssign(ref Fraction first, Fraction second){...}

where first is assigned a new instance of Fraction



More information about the Digitalmars-d mailing list