|
1. 7.42 -
Since all three
calls to Overload.f match up to a method in class Overload based on their
signatures the following outputs are created.
f(int, int): a = 1
f(int, int): b = 2
f(int, double): a = 1
f(int, double): b = 10.2
f(double, double): a = 10.2
f(double, double): b = 3.5
2. Explain why two classes referenced by
the same program can have methods with identical names.
They can have the same name due to OVERLOADING.
Overloading allows same name use as long as the method signatures are
different. Since the name is the same, the signature must have
different types, the number of parameters, or order of the parameters. (p.
344 (Ch. 7.6), Cohoon).
3. Problem 7.54 in the textbook.
Having trouble with this one. Answer to follow shortly.
Send me email
Visit my website
|