Re: Several questions
Re: Several questions
- Subject: Re: Several questions
- From: "John C. Randolph" <email@hidden>
- Date: Fri, 6 Jul 2001 14:09:31 -0700
On Friday, July 6, 2001, at 12:28 AM, jgo wrote:
From: "John C. Randolph" <email@hidden>
Date: 2001 July 02 21:11:36 -0700
On Monday, 2001 July 02 at 18:26, Hisaoki Nishida wrote:
I have some general questions about Cocoa programming...
2. What's the difference between - and + (in method declarations)?
- means an instance method. + means a class method.
Well, I know what a class is, and I know what an instance is,
but what is an "instance method" as opposed to a "class method"?
A Class method, is executed by the class itself. When you send
myString = [NSString stringWithCString:"foo"], you tell the NSString
class to make you a new instance of NSString. An Instance Method is
executed by instances of the class, such as [myString length].
I never considered the possibility that a method would be
instantiated, as contrasted with data members/instance variables.
Well, methods aren't full-fledged objects in Obj-C like they are in
Smalltalk and some other OO languages.
-jcr
[Objc retain];