December 2012
Beginner
552 pages
12h 58m
English
Whenever you implement a setter or getter method, think about what you’re storing in the instance variables, what you’re retrieving, and whether you need to protect these values. For example, consider this when you set the name of one of your AddressCard objects using the corresponding setter method:
newCard.name = newName;
Assume that newName is a string object containing the name for your new card. Assume that inside the setter routine you simply assigned the parameter to the corresponding instance variable:
-(void) setName: (NSString *) theName{ name = theName;}
Now, what do you think would happen if the program later changed some of the characters contained in newName in the program? (This ...
Read now
Unlock full access