5. Classes and Objects

As discussed in Chapter 1, object-oriented programming was introduced to let you handle bigger programming problems, letting you package programming components into easily remembered objects.

The example used in Chapter 1 was a refrigerator. Instead of starting the pumps, regulating the temperature, and starting the compressor yourself in open code, you wrap all those actions into an object containing data (such as the temperature) and methods (that is, functions, such as startCompressor()) into an easily remembered object: a refrigerator. You just put food in the refrigerator, and the refrigerator cools it for you; all the implementation details are hidden from view.

Objective-C object-oriented programming (OOP) lets ...

Get Objective-C: Visual QuickStart 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.