<<< | Index | >>> |
Most cases are intuitive and unambiguous.
Some ambiguities can be resolved by the compiler.
If not, the call is an error and needs to be resolved by programmer.
Resolution tries (in order):
exact match, promotion, and conversion.
void print( char c_ ); void print( int i_ ); void print( char* s_ ); void f() { print( 'g' ); // exact match with char print( 3 ); // exact match with int short x; print( x ); // promote to int print( 3.4 ); // error: ambiguous call to overloaded function print( "OK" ); // exact match with char* print( NULL ); // exact match with int (!!!) }
<<< | Index | >>> |