Operator Overloading

by Chris Buckett, author of Dart in Action

Overloading happens when you provide a new implementation customized to your particular class, which allows you to overload the common operators such as > (greater than) and < (less than). In this article, based on chapter 8 of Dart in Action, author Chris Buckett explains how this function helps you create truly self-documenting code by customizing the meaning built into the standard operators.

When Alice logs into a timesheet app, the system retrieves the Roles that represent the way Alice might use the timesheet system. For example, Alice might be a timesheet user, meaning that she enters her own time into the system. She might also be a timesheet reporter, meaning that she can produce reports based upon other people