The same question goes for | and ||.
Why would one overload or 'use' the & and && operator? The only use i thought of are
- Bitwise Ands for int base types (but not float/decimals) using &
- logical short circuit for bools/functions that return bool. Using the && operator usually.
I cant think of any classes that use those operators. Absolutely none. I know a class might support + (and not '-') which combine two strings together. I seen an object such as datetime overload '-' so two dates can be subtracted to make a timespan (obviously you cant add two dates) but i never seen &, &&, | and || used.
Does anyone know of a use? In any language?