CHAPTER 2 ANSWERS

 
  1. Smalltalk.
  2. The interface or header file with a .h file extension and the implementation file with a .m file extension.
  3. The NSObject class.
  4. The following code defines the ChapterExercise class with a single method named writeAnswer, which takes no arguments and returns nothing:
    @interface ChapterExercise : NSObject

    - (void)writeAnswer;

    @end
  5. You would use this code to instantiate the ChapterExercise class:
    ChapterExercise *anInstance = [[ChapterExercise alloc] init];
  6. The retain keyword increments the reference count, whereas the release keyword decrements it.
  7. ARC stands for Automatic Reference Counting.
  8. The strong keyword indicates the class owns the instance of the object, and it will not be deallocated as long as the strong reference is in place.
  9. Overloading an operator is not permitted in Objective-C as it is in Java and C#.
  10. To compare to NSString instances, you use the isEqualToString: method.
  11. An instance of an NSArray cannot be modified after it’s created, whereas an NSMutableArray can be.
  12. MVC stands for Model-View-Controller.
  13. The following code shows how you declare the ChapterExercise class implements the ChapterExerciseDelegate protocol:
    @interface ChapterExercise : NSObject <ChapterExerciseDelegate>
  14. The NSError class.