Contents    Page-10    Prev    Next    Page+10    Index   

Polymorphic Procedures

A procedure that has multiple type signatures is called polymorphic. In the case of operators, the use of the same operator with different types is called overloading.

+ : integer X integer → integer
+ : real X real → real

Polymorphic procedures are often found in object-oriented programming:


Drawable obj;

obj.draw(x,y);

   becomes:  Circle_draw(obj, x, y)

Within the method, the hidden parameter obj can be referenced using the reserved word this.