Chapter 4
The Objective-C Programming Language
What You Will Learn In This Chapter:
- Understanding the relationship between C and Objective-C
- Learning basic object-oriented concepts like classes, objects, methods, and messages
- Building classes in Objective-C
- Managing memory
Objective-C is a superset of C. Everything that you can do in C, you can also do in Objective-C. The majority of features that Objective-C adds to C enable you to build your programs by using object-oriented (OO) programming techniques. In the last chapter, you learned that C is a structured programming language. Structured languages run in a top down manner and encourage a step-by-step, function-based approach to solving problems.
On the other hand, object-oriented languages encourage a more abstract approach, as you will learn in this chapter. In an object-oriented language like Objective-C, you model your software as a group of objects. Instead of writing functions that do a particular operation, you encapsulate your program logic into these objects. The objects have functions, or methods, that operate on the data contained in the objects. The objects can also contain their own data. Often, you will model the objects in your programs based on real-world objects. This can make object-oriented programs easier to understand. Object-oriented programs can also be easier to debug and modify because you encapsulate all of the functionality and data related to an object in the object itself.
Classes and Objects ...