Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guidance for Cocoa's steep learning curve




On 14 May '08, at 10:16 PM, David Wilson wrote:

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.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >Re: Guidance for Cocoa's steep learning curve (From: Ricky Sharp <email@hidden>)
 >Re: Guidance for Cocoa's steep learning curve (From: Scott Ribe <email@hidden>)
 >Re: Guidance for Cocoa's steep learning curve (From: "David Wilson" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.