• 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: Calling original method implementation from category
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling original method implementation from category


  • Subject: Re: Calling original method implementation from category
  • From: Georg Tuparev <email@hidden>
  • Date: Mon, 25 Apr 2005 14:55:05 +0200


On Apr 25, 2005, at 2:14 PM, Stephane Sudre wrote:

On page 70 in the ObjC PDF you can, among other things, read that that:

"The methods added in a category can be used to extend the functionality of the class or override methods the class inherits. A category can also override methods declared in the class interface. However, it cannot reliably override methods declared in another category of the same class."

And what they warn about is that the loading order of categories is not defined / difficult to predict, so if you have several categories defining / overriding the same method, it will be difficult / impossible to know which one that is going to be used.

Ok, so you can do it but it's a good idea to avoid doing it and it won't work in every case.

Wrong. You can override, and it is very good idea indeed.

What they do not recommend is to override the same method in two or more categories. These are two very different cases!

Georg Tuparev
Tuparev Technologies
Klipper 13
1186 VR Amstelveen
The Netherlands
Mobile: +31-6-55798196

_______________________________________________
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: 
 >Calling original method implementation from category (From: Georg Tuparev <email@hidden>)
 >Re: Calling original method implementation from category (From: Yann Bizeul <email@hidden>)
 >Re: Calling original method implementation from category (From: Georg Tuparev <email@hidden>)
 >Re: Calling original method implementation from category (From: Stephane Sudre <email@hidden>)
 >Re: Calling original method implementation from category (From: j o a r <email@hidden>)
 >Re: Calling original method implementation from category (From: Stephane Sudre <email@hidden>)

  • Prev by Date: Re: Calling original method implementation from category
  • Next by Date: Re: Calling original method implementation from category
  • Previous by thread: Re: Calling original method implementation from category
  • Next by thread: Re: Calling original method implementation from category
  • Index(es):
    • Date
    • Thread