lang • special • compare


Public Sub _compare ( OtherObject As Datatype ) As Integer

This special method is called when two objects of the same class must be compared, for example when sorting an array of objects, or finding a specific object inside an array.

This method is optional. If not implemented, objects are compared by using their internal address in memory.

This method must return an integer:

  • 0 if the two objects are equal.

  • 1 if the current object is greater than OtherObject.

  • -1 if the current object is lower than OtherObject.

See also