Hi guys, I'm trying to implement the Delegate pattern and I would like
a delegate that works like NSURLConnection where any method of the
delegate returns itself. The problem I have is that if I specify its
type in the methods parameters instead of "id":

// RemoteLoader.h
@protocol RemoteLoaderDelegate
-(void) onLoadingFail:(RemoteLoader *)loader;
-(void) onLoadingFinish:(RemoteLoader *)loader;
-(void) onLoadingProgress:(RemoteLoader *)loader;
@end

@interface RemoteLoader : NSObject
{
        ...
}
...
@end

I get: "error: syntax error before 'RemoteLoader'"


If I leave "id" in the protocol definition:

@protocol RemoteLoaderDelegate
-(void) onLoadingFail:(id)loader;
-(void) onLoadingFinish:(id)loader;
-(void) onLoadingProgress:(id)loader;
@end

but leave the typed parameter in the implemented methods:

-(void) onLoadingFail:(RemoteLoader *)loader
{
        ...
}

I get: "warning: conflicting types for
'-(void)onLoadingFail:(RemoteLoader *)loader'" but it works.


Is there a way to implement this typed delegation without warning errors?


Thanks for any suggestion, chr
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to