ios - Objective C: several categories on one class -


i must have misunderstood categories made category on class extend methods, , make methods abstract following oop guidelines. thought when #import , use category methods in category called. instead find when #import , use base class, class automatically call method in category on class, not itself.

what wanted if user tried use method in class without category exception trowed. , way make different categories on same class different internal behavior.

am misunderstanding categories ?

categories add methods class without condition or other means of picking , choosing.

once methods added class, there no removal short of mucking runtime directly.

subclasses inherit additional methods.

it doesn't matter if #import method declarations or not.

if want different versions of class, declare different subclasses.


Comments