Navigation: Language Reference > 2 - Program Source Code Format > Procedure Overloading >====== Procedure Overloading ====== | |
Procedure Overloading means allowing multiple PROCEDURE definitions to use the same name. This is one form of polymorphism. In order to allow this each PROCEDURE using a shared name must receive different parameters so the compiler can decide, based on the parameters passed which PROCEDURE to call.
The idea here is to allow more than one procedure of the same name, but with different prototypes, so separate (but usually similar) operations can occur on different data types. From an efficiency viewpoint, Procedure Overloading is much more efficient than coding a single procedure with omittable parameters, for those cases where you may or may not receive multiple parameters.
The Clarion language also allows polymorphic procedures through the use of the ? and *? parameters, but Procedure Overloading extends this polymorphic ability to also include Entity-parameters and “named group” parameters.
One example of Procedure Overloading is the Clarion OPEN statement, which initializes an entity for use in the program. Depending on what type of entity is passed to it (a FILE, a WINDOW, a VIEW, …), it performs related but physically different functions.
See Also: