Example 1.1. Polymorphism
"!iH"~reverse /* Reverses the characters "!iH" to form "Hi!" */ pen~reverse /* Reverses the direction of a plotter pen */ ball~reverse /* Reverses the direction of a moving ball */
!iH
object's REVERSE code is different from the plotter pen's, the method name can be the same because Rexx keeps track of the methods each object owns. The ability to reuse the same method name so that one message can initiate more than one function is another feature of polymorphism. You do not need to have several message names like REVERSE_STRING, REVERSE_PEN, REVERSE_BALL. This keeps method-naming schemes simple and makes complex programs easy to follow and modify.