• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Several questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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];


References: 
 >Re: Several questions (From: jgo <email@hidden>)

  • Prev by Date: Re: Several questions
  • Next by Date: Re: Several questions
  • Previous by thread: Re: Several questions
  • Next by thread: Re: Several questions
  • Index(es):
    • Date
    • Thread