Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Operator overloading enables you to define how instances of your class should behave when they’re used in expressions. For example, if you want to be able to add instances together, you can define operator +:
class Magnitude {
//...
public static operator +(Magnitude a, Magnitude b) {
return Magnitude(a.size + b.size);
}
}