• 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
Re: How do I give a set of methods to some objects but not others?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I give a set of methods to some objects but not others?


  • Subject: Re: How do I give a set of methods to some objects but not others?
  • From: Philip Mötteli <email@hidden>
  • Date: Fri, 24 Nov 2006 23:05:16 +0100

Am 24.11.2006 um 20:59 schrieb Alan Smith:

Protocols:
They would work except I would then have to implement it over and over
again and each implementation would be the same. I want to find a way
to only implement the methods once and then use that one
implmentations.

I think, if I correctly understood you, I have done something like this. It's actually simple.
I did this for something, that I actually consider a bug of Apple's Foundation framework. The collection classes should have a common abstract superclass. I have many methods, that are of exactly the same implementation for NSSet and NSArray (and other collection classes I have created myself).
Just create an implementation file (*.m) and put your method implementations in it. No class declaration, just the method implementation. Then import this file into your class where you want them to be – like this:


	#import "YourMethods.m"

Now, do the same with your method declarations.

I'm not completely happy with that solution. It gives some warnings, that I just can't get rid of. But it solves the initial problem.


Re Phil

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >How do I give a set of methods to some objects but not others? (From: "Alan Smith" <email@hidden>)
 >Re: How do I give a set of methods to some objects but not others? (From: Daniel Jalkut <email@hidden>)
 >Re: Re: How do I give a set of methods to some objects but not others? (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Repositioning an NSTextFieldCell?
  • Next by Date: Re: How can I get an instance specific identifier?
  • Previous by thread: Re: How do I give a set of methods to some objects but not others?
  • Next by thread: Re: How do I give a set of methods to some objects but not others?
  • Index(es):
    • Date
    • Thread