已读42%
预计阅读本页时间:-
预计阅读本页时间:-
CHAPTER 2 ANSWERS
- Smalltalk.
- The interface or header file with a .h file extension and the implementation file with a .m file extension.
- The NSObject class.
- 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 - You would use this code to instantiate the ChapterExercise class:
ChapterExercise *anInstance = [[ChapterExercise alloc] init];
- The retain keyword increments the reference count, whereas the release keyword decrements it.
- ARC stands for Automatic Reference Counting.
- 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.
- Overloading an operator is not permitted in Objective-C as it is in Java and C#.
- To compare to NSString instances, you use the isEqualToString: method.
- An instance of an NSArray cannot be modified after it’s created, whereas an NSMutableArray can be.
- MVC stands for Model-View-Controller.
- The following code shows how you declare the ChapterExercise class implements the ChapterExerciseDelegate protocol:
@interface ChapterExercise : NSObject <ChapterExerciseDelegate>
- The NSError class.