objective c - Call precedence for method overridden in category and again in subclass -


i'm working on project in objective-c , i'm facing situation.

let's have class named foo. implement category class named foo+bar , override foo's method foomethod:.

then create subclass foo, named baz , override same foomethod: in class.

  1. when use method foomethod: on baz object, implementation called? 1 inside foo+bar or 1 inside baz?
  2. how objective-c handle situation , why?

i'm open explanation and/or documentation.

behaviour if override method in category explicitly undefined. please don't:

if name of method declared in category same method in original class, or method in category on same class (or superclass), behavior undefined method implementation used @ runtime.

if overriding method defined once in category of superclass of course subclass implementation called.

but here override method defined twice in superclass. behaviour undefined, because override undefined implementation. if worked, bad code anyway.

really, please don't this.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -