21 Object Instance Variables and Properties

Thus far, the instance variables of your objects have been mostly simple C types like int or float. It is far more common for instance variables to be pointers to other objects, like _hireDate. An object instance variable points to another object and describes a relationship between the two objects. Usually, object instance variables fall into one of three categories:

  • Object-type attributes: a pointer to a simple, value-like object like an NSString or an NSDate. For example, an employee’s last name would be stored in an NSString. Thus, an instance of BNREmployee would have an instance variable that would be a pointer to an instance of NSString. We recommend that you always declare ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.