• 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: Question about categories
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about categories


  • Subject: Re: Question about categories
  • From: Stephen Deken <email@hidden>
  • Date: Sat, 2 Sep 2006 17:38:18 -0500

So, sinse I can't add onto a method... If I subclass it there are
several methods that return an object of its class. That wouldn't do
because then only the first object would have the extra methods that I
add. So... I tried overriding those methods like this:

It sounds like you want to do class posing. Try this -- subclass the class you're working with, and override its init method so that it calls [super init].


Then, somewhere early in your application -- usually in main() before the NSApplication line -- call the class method poseAsClass on your new class. For example, to change all NSExistingClass into MyNeatClass, you would do:

	[MyNeatClass poseAsClass:[NSExistingClass class]];

From then on, all calls to NSExistingClass's -[init] would actually go through your MyNeatClass.

HTH,

Stephen Deken
email@hidden

_______________________________________________
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


References: 
 >Question about categories (From: "Alan Smith" <email@hidden>)
 >Re: Question about categories (From: Andrew Merenbach <email@hidden>)
 >Re: Question about categories (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: Question about categories
  • Next by Date: How to make Metronome?
  • Previous by thread: Re: Question about categories
  • Next by thread: Re: Question about categories
  • Index(es):
    • Date
    • Thread