Skip to main content

Operator Overloading

Posted by manning_pubs on January 11, 2013 at 2:35 PM PST



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

AttachmentSize
dart101.png42.56 KB
dart102.jpg9.88 KB
dart103.jpg10.73 KB
dart104.jpg24.25 KB