|
home—info—lects—labs—exams—hws
tutor/PIs—breeze (snow day)
Object120 + its docs—java.lang docs—java.util docs
Overloading:
Two functions with the same name, but with different signatures.
Note that when looking at a function call, it's possible to discern which function you want,
based on the different signature.
Fore example:
We can overload functions ourselves: we can write
We will complete last week's lab10a—practicing loops: 99 bottles, and check you off (through #8) — that's six functions, but four of them will be a single line, and one more will be a loop with only two lines in the body. The only long one is printing a single verse!
Be sure not to have lots of repeated code! In particular:
1 A more challenging task would be eliminating some of the words that are repeated within a single verse — e.g. changing “on the wall” to “off the shelf” is more reasonable to require two changes. However, you certainly are able (and welcome) to make that updatable-with-only-one-change. ↩
home—info—lects—labs—exams—hws
tutor/PIs—breeze (snow day)
Object120 + its docs—java.lang docs—java.util docs
©2012, Ian Barland, Radford University Last modified 2012.Nov.01 (Thu) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |