Protocol + Delegate = conflict types
Protocol + Delegate = conflict types
- Subject: Protocol + Delegate = conflict types
- From: "Christian Giordano" <email@hidden>
- Date: Fri, 16 Jan 2009 08:38:35 +0000
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 (email@hidden)
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:
This email sent to email@hidden