Question types

Start with

Question limit

of 14 available terms

Print test

12 Matching questions

  1. The self keyword
  2. Method with multiple arguments
  3. The interface file (.h) tells the computer what a Fraction class looks like: it has six instance methods. The first three methods don't return a value. The next two return an int, and the last one returns a double. The setNumerator: and setDenominator: methods each take an integer argument.
  4. Comparison code
  5. Synthesized Accessor Methods
  6. The Dot Operator
  7. importing files
  8. The static keyword
  9. Two files created when you make a new class
  10. @property example
  11. @synthesize example
  12. local variables
  1. a Simply set each extra argument with a colon following it

    [myFraction setNumerator: 1 andDenominator: 3];
    [myFraction set: 1 over: 3]

    another way:
    [aFraction set:1 :3]
  2. b [myFraction setNumerator: 1];
    [myFraction setDenominator: 3];

    same as..

    myFraction.numerator = 1;
    myFraction.denominator = 3;
  3. c header (.h) [interface]
    implementation (.m)
  4. d Note
  5. e As of Objective-C 2.0, you can have your setter and getter methods (collectively known as accessor methods) automatically generated for you
    1. create the @property in the interface file
    2. create the @synthesize in the implementation file
  6. f variables that can only be accessed from within the method that they are defined.

    - (void) reduce
    int u = numerator;

    You must set local variables to a value before you can use them.
  7. g Use this keyword to refer directly to the receiver of the current message.

    Use it inside a method

    Inside the add: method
    [self reduce]
    this would reduce the current object
  8. h @implementation Fraction

    @synthesize numerator, denominator

    Creates four methods:
  9. i @interface Fraction : NSObject

    @property int numerator, denominator;
  10. j You can have a local variable retain its value through multiple invocations of a method by placing the keyword static in front of the variable's declaration.

    static int hitcount = 0;
    Has an intial value of 0.
  11. k Used to access properties:
    [myFraction numerator]
    is the same as

    General format

    Assign values = value
  12. l <> system files
    "" local files