6. Classes and Objects
Objects are the basis for object-oriented programming. This chapter gets down to the business of making objects. The chapter is divided into five main sections:
• Defining classes
• Extending classes by subclassing
• Creating objects (instances of a class)
• Destroying objects
• Copying objects
Some of these topics were covered briefly in Chapter 3, “An Introduction to Object-Oriented Programming.” They are presented here in greater detail.
Defining a Class
When you define an Objective-C class, you have to provide the compiler with two sets of information. The first set is essentially a blueprint for constructing instances of the class. You have to specify the class’s name, the class’s superclass, a list of the names and ...
Get Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition 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.