Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
All instance variables are protected in Objective-C by default, so you should always use accessors to get and set values. You should even use them when getting and setting values within the object itself. This is partially just because it’s better encapsulation, but the other reason is that Cocoa offers some more advanced “generic programming” features that depend on using accessors properly. Here’s an example of using accessors for the caption instance variable:
[photo setCaption:@"Day at the Beach"]; currentCaption = [photo caption];