Chapter 7. Objects Objects Everywhere

In This Chapter

  • Turning numbers into objects

  • Working with mutable arrays

  • Using each object in an array in a message

  • Getting to know C arrays

Now that you know how to create classes and send messages to your objects, I want to expand your ideas about what you can do with objects. So far, what you have done is send messages from main to the objects you created. What you will soon find out is that your objects will be sending messages to other objects to assist them in carrying out their responsibilities as well. You'll also discover that you don't have to write all of the objects you need to use in your program. The frameworks I mentioned in Chapter 1 supply many of them for you. So you'll not only be creating your own objects, but also using the objects in Cocoa's Foundation classes that provide some of the "utility" functionality you need.

In this chapter, I'll introduce you to two of those objects. The first is NSNumber, one of the hundred or so classes in the Foundation Framework. All of the data types I explained in Chapter 4, signed or unsigned char, short int, int, long int, long long int, float, double, and BOOL, can be represented using the NSNumber class.

The second will be NSMutable arrays. Arrays are what you will use to manage lists of objects. While right now there are not that many objects to manage, as you develop your application, you'll begin to see how useful they can be. In this chapter, I'll show you how to take the NSNumber objects ...

Get Objective-C® For Dummies® 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.