Overloaded functions and operators
. Overloaded symbol has different meaning depending upon the context
. In maths + is overloaded; used for integer, real, complex, matrices
. In Ada () is overloaded; used for array, function call, type conversion
. Overloading is resolved when a unique meaning for an occurrence of a symbol is determined
The compiler must determine which overloaded function to use in a particular context. It looks at the number and type of arguments passed. Overloading is resolved when a unique meaning for an occurrence of a symbol is determined. Compiler does NOT look at function return types to resolve choice. It is illegal for two or more functions to differ only by return type.
|