Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
When you program in Objective-C, you can use all the usual standard C numerical data types for making calculations. If you want to use these values with Cocoa's array objects, however, you're left out in the cold. For this reason, Cocoa offers you the NSNumber class. One of its great uses is to wrap numbers in a Cocoa object, for use with other objects, such as NSArray. The NSArray class is an array class that comes with the Foundation Kit. You hear more about it later in this chapter.
To create an NSNumber object based on an integer value of 42, use code like this: