December 2013
Beginner
576 pages
16h 4m
English
Let’s continue to work with the Fraction class and make some additions. You have defined six methods. It would be nice to have a method to set both the numerator and the denominator with a single message. You define methods that take multiple arguments simply by listing each successive argument followed by a colon. This becomes part of the method name. For example, the method named addEntryWithName:andEmail: takes two arguments, presumably a name and an email address. The method addEntryWithName:andEmail:andPhone: takes three arguments: a name, an email address, and a phone number.
A method to set both the numerator and the denominator could be named setNumerator:andDenominator:, and you might use it like this: ...
Read now
Unlock full access