Objective-C Objects

From a C programmer’s point of view, Objective-C objects are just C structures with the following layout defined in objc.h:

typedef struct objc_object { 
       Class isa; 
} *id; 

The objc.h file, and the others that implement Apple’s Objective-C runtime, are available as part of Apple’s Darwin open-source project at http://www.opensource.apple.com/projects/darwin/.

The objc_object structure declaration shows that the only requirement for memory to be used as an object is the presence of the isa element, and any such memory can be referenced by the type id.

The isa Element

The essential element in every Objective-C object is the isa element with the type Class. The type Class is described in its own section in this appendix. For ...

Get Cocoa® Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.