O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing Comparison Operators

In principle, comparison operators can be implemented for custom types in a manner similar to calculation operators, with two additional conditions:

  • Comparison operators must always return a Boolean data type as the function result. The Boolean value informs callers whether the comparison was successful.

  • You must implement comparison operators in pairs. For example, if you implement an operator that checks for equal, you must also implement an operator that checks for not equal. If you implement a size comparison, you must also implement operators for greater than and less than. The same applies to equal to or greater than and equal to or less than.

The comparison operator implementation for the SuperString class ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required