NEWBIE: Why use protocols?
NEWBIE: Why use protocols?
- Subject: NEWBIE: Why use protocols?
- From: "Ben D. Jones" <email@hidden>
- Date: Wed, 18 May 2005 11:11:12 -0400
Hello,
This is a newbie question I'm sure, but I'm really not clear on
this concept. Coming from a C background the concept of protocols
isn't very clear. Objective-C is my first truly OOP language and
maybe I'm not understanding OOP correctly. My question is... if
you have a class and protocol like this:
@interface MyClass : NSObject <MyProtocol>
{ @protocol UpDown
NSString
*aString;
- (void)increment;
}
-(void)decrement;
- (void)
doStuff;
@end
- (id)doMoreStuff:(NSString *)withAString
isn't that clear enough to put the methods of that protocol in the
MyClass def without the use of a protocol to "make sure it conforms
to a protocol" ? Or is there some type of implementation that I
haven't run into yet in my projects where it would be important.
Basically... I don't get why or when the use of a protocol is a must
for clarity or function.
Ben D. Jones
Apricle Technologies
http://www.apricle.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden