Lecture overview -- Keyboard shortcut: 'u'  Previous page: Function Overloading -- Keyboard shortcut: 'p'  Next page: Function Overloading - Examples  -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 2 - Page 26 : 42
Notes about C++
Basic facilities
Function Overloading - more detailed rules

Matching the type of an actual parameter and the type of a formal parameter

The criateria below are tried in order

The call is ambiguous if two or matches are found at the same level

  • The C++ Programming Language: Page 149
 

  • Exact match

    • Only trivial conversions are performed

    • Array name to pointer, function name to function pointer, T to const T,...

  • Match using promotions

    • Integral promotions and floating point promotions

    • bool to int, char to int, short to int, float to double, ...

  • Match using standard conversions

    • int to double, double to int, double to long double derived* to base*, T* to void, ...

  • Match using user defined conversions

    • Conversion operators and constructors

  • Match using the ellipsis ...

    • Unspecified number of arguments