Last updated
Last updated
Operators allow you to change something about the Money and will return a new instance of the Money. For example, the methods: add, subtract, multiply, and divide on the Money
class are all MoneyOperators.
You can create your own Money Operators and use them with the Money class out of the box.
Here's how it works in slightly more detail.
As you can see, using Operators provides you some power. You could create your Operator to calculate a payment amount for a loan. Another great idea is to use an Operator that can calculate tax.