Re: Class Clusters
Re: Class Clusters
- Subject: Re: Class Clusters
- From: Nathan Day <email@hidden>
- Date: Thu, 22 May 2003 12:46:20 +0930
When I do this sort of thing I just have some factor methods that
return autoreleased instances of the correct sub class and then
describe in the documentation that this is the correct way to get
instances and not init and alloc. Going to all of the effort of doing
the init/alloc mojo is overkill most of the time unless you are
creating some frame that will be made public.
On Wednesday, May 21, 2003, at 01:44 AM, Drew McCormack wrote:
I actually did read this article. I don't really understand what the
purpose of the placeholder class is. The article just says we do it
"...because Apple does it...". I can't see the difference between
returning a DataSet instance or a PlaceholderDataSet instance from
DataSet's alloc method.
And as far as I can tell, it doesn't actually help with my problem. My
question is, in the init... methods of the private subclasses of
DataSet, which DataSet constructor should I chain to? In the example
you have given, the problem still exists, because your DataSet "init"
method returns nil. So you can't do this in FileHandleDataSet, for
example,
-(id)initWithFileHandle:(NSFileHandle *)fh {
if ( self = [super init] ) {
....
}
return self
}
because [super init] is the DataSet init method, which returns nil. I
guess the init method of DataSet should be omitted, and then everything
will work, right?
Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.