Examples of overload resolution
void foo(long p) {. . .} // Signature I
void foo(int p) {. . .} // Signature II
void foo(long p, int q) {. . .} // Signature III
void foo(int p, long q) {. . .} // Signature IV
long l ;
short s ;
int i ;
foo(l) ; // Exact match—use Signature I.
foo(s) ; // Do widening conversion of s to int, and use
// Signature II—unique “most specific” case.
foo(l, s) ; // Uses Signature III—only case applicable by
// widening conversions.
foo(i, i) ; // Compile time error! Signatures III and IV
// are both applicable but neither is more specific
// than the other!