Re: Datasource for tableview and more
Re: Datasource for tableview and more
- Subject: Re: Datasource for tableview and more
- From: Jim Correia <email@hidden>
- Date: Sun, 2 Sep 2001 10:36:54 -0400
At 12:58 AM -0400 9/2/01, Brendan Younger wrote:
The first one. Any method with a "+" preceding it means that it returns
a completely new object. A method with a "-" sign means that if you
already have an object, you can call upon it to execute that method.
[snip]
Declaring methods with "+" or "-" only tells the compiler and users of
the class which methods create new instances and which methods are
performed only by specific instances of the class. The tacit assumption
is that you implement these methods to do what the "+" or "-" sign
implies.
That is incorrect.
+ 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