• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NEWBIE: Why use protocols?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: NEWBIE: Why use protocols?
      • From: Shawn Erickson <email@hidden>
    • Re: NEWBIE: Why use protocols?
      • From: Ondra Cada <email@hidden>
    • Re: NEWBIE: Why use protocols?
      • From: Cameron Hayne <email@hidden>
  • Prev by Date: Re: Can NSCell draw both an icon and text?
  • Next by Date: Loading already scaled JPEGs
  • Previous by thread: Re: HTTP server with NetSocket
  • Next by thread: Re: NEWBIE: Why use protocols?
  • Index(es):
    • Date
    • Thread