Protocols seems definitely the way to go and seems to work, I'm only getting some warnings. Basically what I did, I pass the instance implementing the protocol with this syntax:
- (void) addListener:(id <MyProtocol> *) listener and I get "invalid receiver type 'id <MyProtocol>*' Funny enough after I get another warning. I basically want to add the listener to a NSMutableArray with this syntax: [listeners addObject:listener] and I get "passing arguments 1 of 'addObject:' from incompatible pointer type. I am new to Objective-C so I thought in my ignorance, maybe id <MyProtocol> defines already a pointer and removing the "*" doesn't gives those errors but where I was checking for the conformity with: if ( ! [listener conformsToProtocol:@protocol(MyProtocol)] ) { I get "'-conformsToProtocol:' not found in protocol(s)" Any idea? Thanks, chr On Thu, Aug 28, 2008 at 11:21 AM, Matthias Schonder <[EMAIL PROTECTED]> wrote: > You may read this: > > http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_7_section_6.html#//apple_ref/doc/uid/TP30001163-CH15-TPXREF148 > > > On 28.08.2008, at 12:14, Christian Giordano wrote: > >> Hi guys, I would like to create an Interface which will be eventually >> implemented by some classes. I am a bit confused here, in objective-c >> the .h files are basically already interfaces. Ok, but how could a .m >> file implements more than one? I couldn't find any document explaining >> how to implements multiple interfaces. In my ignorance I created a >> normal .h file MyInterface.h and after importing it in my implementing >> class header, I express it with the syntax that I've seen already: >> >> @interface MyClass : NSObject <MyInterface> { >> } >> >> The problem is that I get a compiler error on the interface >> declaration line saying: "cannot find protocol declaration for >> 'MyInterface'". >> >> Does someone have any link or tips that might help me? >> >> >> Thanks, 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/mschonder%40aycan.de >> >> This email sent to [EMAIL PROTECTED] >> > > -- > > Mit freundlichen Gruessen > Best regards > > .Matthias Schonder > .aycan Digitalsysteme GmbH > .Innere Aumuehlstrasse 5 > .97076 Wuerzburg . Germany > .+49.(0)9 31.270 40 9.0 . phone > .+49.(0)9 31.270 40 9.1 . fax > .mailto:[EMAIL PROTECTED] > .http://www.aycan.de > > .Sitz der Gesellschaft: Wuerzburg > .eingetragen beim Amtsgericht Wuerzburg > .HRB 6043 > .Geschaeftsfuehrung: > .Dipl.-Ing. Stephan Popp > .Dipl.-Ing. Matthias Broenner > > > _______________________________________________ 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 [EMAIL PROTECTED]