The following example is one of several I have run into recently.
Inheritance is as follows: CAKeyframeAnimation: CAPropertyAnimation :
CAAnimation. CAKeyframeAnimation has no explicit initializer or factory
method. Dudney's book uses [CAKeyframeAnimation animation] to create an
On Nov 3, 2008, at 10:53 AM, Gordon Apple wrote:
The following example is one of several I have run into recently.
Inheritance is as follows: CAKeyframeAnimation:
CAPropertyAnimation :
CAAnimation. CAKeyframeAnimation has no explicit initializer or
factory
method. Dudney's book
--- On Mon, 11/3/08, Gordon Apple [EMAIL PROTECTED] wrote:
Is there a basic assumption that such factory methods
are implicitly
redefined for all subclasses?
It's not implicitly redefined -- just inherited. One of the advantages of
Objective-C's dynamic nature is that [[[self class]
Is self even defined for a class object? If so, should case 1 (or
similar) be the assumed implementation for all of Cocoa? If not, then,
IMHO, the docs in general should specify which is is for each factory
method.
On 11/3/08 10:06 AM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
On Nov 3,
On Mon, Nov 3, 2008 at 11:30 AM, Gordon Apple [EMAIL PROTECTED] wrote:
Is self even defined for a class object? If so, should case 1 (or
similar) be the assumed implementation for all of Cocoa? If not, then,
IMHO, the docs in general should specify which is is for each factory
method.
Gordon Apple wrote on 03/11/2008 16:30:57:
Is self even defined for a class object?
Yes; in any method, self is (or at least starts life as) the object which
received the message.
If so, should case 1 (or
similar) be the assumed implementation for all of Cocoa?
I don't think that
On Nov 3, 2008, at 11:30 AM, Gordon Apple wrote:
Is self even defined for a class object?
Yes.
If so, should case 1 (or
similar) be the assumed implementation for all of Cocoa? If not,
then,
IMHO, the docs in general should specify which is is for each factory
method.
Either way,
On Nov 3, 2008, at 8:37 AM, Michael Ash wrote:
If the method is declared like this then you should assume that you
get a subclass:
+ (id)foo;
And if it is declared like this then you should not assume that:
+ (Foo *)foo;
The difference being the return type. The 'id' return type implicitly
Ok, it looks like I should assume (at least in Cocoa) that the inherited
factory methods normally return the calling class. I guess I've normally
assumed that, but just never questioned it. For example, I have often used
[NSMutableArray array] without even thinking about it, although I've
On Nov 3, 2008, at 11:30 AM, Gordon Apple wrote:
Is self even defined for a class object?
`self` is the class object when you are in a class method.
If so, should case 1 (or similar) be the assumed implementation for
all of Cocoa? If not, then, IMHO, the docs in general should
specify
On Mon, Nov 3, 2008 at 11:57 AM, j o a r [EMAIL PROTECTED] wrote:
On Nov 3, 2008, at 8:37 AM, Michael Ash wrote:
If the method is declared like this then you should assume that you
get a subclass:
+ (id)foo;
And if it is declared like this then you should not assume that:
+ (Foo *)foo;
11 matches
Mail list logo