NAME

Question types


Start with


Question limit

of 14 available terms

Print test

14 Multiple choice questions

  1. 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
  2. <> system files
    "" local files
  3. Simply set each extra argument with a colon following it

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

    another way:
    set::
    [aFraction set:1 :3]
  4. 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
  5. Used to access properties:
    [myFraction numerator]
    is the same as
    myFraction.numerator

    General format
    instance.property

    Assign values
    instance.property = value
  6. 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.
  7. Note
  8. header (.h) [interface]
    implementation (.m)
  9. [myFraction setNumerator: 1];
    [myFraction setDenominator: 3];

    same as..

    myFraction.numerator = 1;
    myFraction.denominator = 3;
  10. Note
  11. @interface Fraction : NSObject

    @property int numerator, denominator;
  12. Note
  13. @implementation Fraction

    @synthesize numerator, denominator

    Creates four methods:
    numerator
    setNumerator
    denominator
    setDenominator
  14. 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.