Re: Guidance for Cocoa's steep learning curve
Re: Guidance for Cocoa's steep learning curve
- Subject: Re: Guidance for Cocoa's steep learning curve
- From: Jens Alfke <email@hidden>
- Date: Thu, 15 May 2008 07:59:48 -0700
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:
This email sent to email@hidden