Week 9 Discussion

 

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

 


 

Home | Photos | WaterMark Multimedia | Online Shopping Outlet

Matt's Bio | UMUC | Feedback | Guest book | E-mail me

 

FaulknerWeb.com is designed and managed by Matt Faulkner.

Domain Name service provided by Namesecure

Web Service by eDataRack
Copyright © 1998 - 2011 [FaulknerWeb.com]. All rights reserved.
Updated: October 15, 2011 21:53 .