Re: Datasource for tableview and more
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