码迷,mamicode.com
首页 > 其他好文 > 详细

categoriy 重写函数会怎样?

时间:2015-05-26 12:26:34      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:

From comp.lang.objective-C FAQ listing: "What if multiple categories implement the same method? Then the fabric of the Universe as we know it ceases to exist. Actually, that‘s not quite true, but certainly some problems will be caused. When a category implements a method which has already appeared in a class (whether through another category, or the class‘ primary @implementation), that category‘s definition overwrites the definition which was previously present. The original definition can no longer be reached by the Objective-C code. Note that if two categories overwrite the same method then whichever was loaded last "wins", which may not be possible to predict before the code is launched."

From developer.apple.com: "When a category overrides an inherited method, the method in the category can, as usual, invoke the inherited implementation via a message to super. However, if a category overrides a method that already ex

categoriy 重写函数会怎样?

标签:

原文地址:http://www.cnblogs.com/studyNT/p/4530081.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!