www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: user defined implicit casts

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
Aug 02 2007