I\'m a relative newbie to Objective-C (only studied Arron Hillegras\'s book) and am confused by the following snippit of code I\'ve found in one of Apple\'s code examples, i
It's usually called the 'arrow' operator. It allows you to access the instance variables of an object (or of a struct
) using a reference or pointer to the instance. It's common syntax with C and C++.
I'm struggling to find a nice write up, but you might find this one informative.
As to the underscore - commonly they mean "private"; according to the Coding Guidelines for Cocoa - Naming Basics:
Avoid the use of the underscore character as a prefix meaning private, especially in methods. Apple reserves the use of this convention. Use by third parties could result in name-space collisions; they might unwittingly override an existing private method with one of their own, with disastrous consequences.