O'Reilly logo

Objective-C Quick Syntax Reference by Matthew Campbell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 17

image

Class Methods

Class Methods Defined

In Chapter 16, we described how to define classes with properties and methods. The type of method we focused on was instance methods. Instance methods are methods can only be used with objects. When you want to use an instance method, you send a message to an object.

For instance, if you want to send the generateReport message to a Project object, you first need create the object and then send the message right to the object.

Project *p = [[Project alloc] init];[p generateReport];

Class methods are like instance methods except that they can only be used with classes. When you want to use a class method, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required