Static operator overloads (again)

Giles Bathgate gilesbathgate at gmail.com
Wed Sep 3 01:56:27 PDT 2008


Christopher Wright Wrote:

> I don't particularly think that it would benefit the language. There's 
> no difference between a method call and using an operator overload. If 
> you find yourself doing a lot of null checks, you might want to check 
> out the Null Object pattern.

The point is when I write 

t += b;

I don't expect a null reference exception. With operator overloads the only way (that made sense to me) to achieve this was to make the opCatAssign method static, but then my dilemma is that I no longer have an access to the value of t within the opCatAssign method call.



More information about the Digitalmars-d mailing list