Data Structures, Algorithms, & Applications in C++
Chapter 1, Exercise 5
- (a)
-
The signature of the function invocation agrees with that of
the
abc function of Program 1.1.
Therefore, the abc function of
Program 1.1 is invoked.
- (b)
-
The signature of the function invocation agrees with that of
the
abc function of Program 1.2.
Therefore, the abc function of
Program 1.2 is invoked.
- (c)
-
The signature of the function invocation does not agree
with that of either of the
abc functions.
Since type conversions from both float to
int and
int to
float are possible,
C++ cannot resolve which function to use and gives a compile-time error.
- (d)
-
The actual parameters are of type
double.
C++ cannot resolve which function to use and gives a compile-time error
as type conversions from
double to both
int and
float are possible.