• 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: Datasource for tableview and more
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Datasource for tableview and more


  • Subject: Re: Datasource for tableview and more
  • From: Brendan Younger <email@hidden>
  • Date: Sun, 2 Sep 2001 14:48:57 -0400

+ is a class method. - is an instance method. Nothing more. Nothing less.

I don't know where you got the misconception that + methods return a new object.

Given the class Foobar, you could write

+ (void)doSomethingUseful;

[Foobar doSomethingUseful];


It is nice to be helpful and to want to give people advice. However, you should make sure you are giving them correct advice, or they will end up worse off than they started. Ondra's advice, while possibly curt, does lead one to the correct answer. Understanding the difference between class an instance methods is an important concept that one needs to understand correctly, not in some hand waving incorrect + methods return new objects way.

Jim

Yes, I did over-simplify. But let just say in my defense that what you call hand-waiving is often best for beginners. When I was learning (not more than a few months ago), I was completely confused as to why one even needed the + and - signs. Thinking of them as "creates-a-new-object" and "implemented-by-an-existing-one" was the most coherent way (for me) to understand their use. Then, later on, one comes across things like [NSThread exit] and realizes that it's just short-hand for the conceptual [[NSThread currentThread] exit]. Sometimes pointing out "gotchas" and damaging misconceptions is very helpful to the beginner, but in this particular case I didn't think it was warranted.

Brendan Younger


  • Follow-Ups:
    • Re: Datasource for tableview and more
      • From: Jim Correia <email@hidden>
References: 
 >Re: Datasource for tableview and more (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: NXAtom
  • Next by Date: Re: Another controversial question
  • Previous by thread: Re: Datasource for tableview and more
  • Next by thread: Re: Datasource for tableview and more
  • Index(es):
    • Date
    • Thread