3) Instance methods (with the -) are virtual functions. Class
methods (with the +) are static functions.
Class methods aren't exactly like static functions, because they're
still dynamically dispatched and can be overridden by subclasses.
A closer analogy is to think of there being a singleton "class object"
for every class (which is what -class returns), and the class methods
are instance methods of those class objects. The class objects have an
inheritance hierarchy that parallels the class hierarchy, so if B is a
subclass of A, B's class object will be a subclas of A's class object.
(For more detail, look up "metaclass"; I'm sure there's an abstruse
Wikipedia article about it. The concept goes back to Smalltalk-80, on
which Objective-C's runtime model and syntax were based.)
—Jens
PS: In regards to the thread subject, I didn't find Cocoa to have a
steep learning curve. I took a training class and was amazed at how
easy it was to learn, and to build sophisticated apps with, compared
to every other GUI API or framework I'd used.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
This email sent to email@hidden