tags:

views:

30

answers:

1

Are class methods convenience methods i.e. part of the framework e.g. +(id)alloc and instance methods are those that were implemented by the developer?

I can't seem to understand the difference between instance methods and class methods.

+1  A: 

A class method is a message sent to the class object, whereas an instance method is a message sent to an instance of that class.

For instance:

[Dog allDogs]; // class method: ask the class Dog about its instances
[theDog bark]; // instance method: tell a specific instance of Dog to bark
Jonathan Sterling
How can you ask a class something before its instantiated?I am beginner 101 with Objective C - come from C# background...trying to learn!
You're messaging the class itself, not an instance of the class. I's equivalent to Java's static methods.
Terry Wilcox