I'm working on a project in Objective-C and I'm facing a situation.
Let's say I have a class named Foo
. I implement a category for this class named Foo+Bar
and override Foo
's method fooMethod:
.
Then I create a subclass for Foo
, named Baz
and override the same fooMethod:
in this class.
- When I use the method
fooMethod:
on aBaz
object, which implementation will be called? The one inside theFoo+Bar
or the one insideBaz
? - How does Objective-C handle this situation and why?
I'm open to any good explanation and/or documentation.