Objective-C permits a class to entirely replace another class within an application. The replacing class is said to “pose as” the target class. All messages sent to the target class are then instead received by the posing class. There are some restrictions on which classes can pose:
·A class may only pose as one of its direct or indirect superclasses
·The posing class must not define any new instance variables which are absent from the target class (though it may define or override methods).
·No messages must have been sent to the target class prior to the posing.
Posing, similarly to categories, allows globally augmenting existing classes. Posing permits two features absent from categories:
·A posing class can call overridden methods through super, thus incorporating the implementation of the target class.
·A posing class can override methods defined in categories.
Liked By
Write Answer
What is posing in iOS?
Join MindStick Community
You have need login or register for voting of answers or question.
Tarun Kumar
06-Aug-2015Objective-C permits a class to entirely replace another class within an application. The replacing class is said to “pose as” the target class. All messages sent to the target class are then instead received by the posing class. There are some restrictions on which classes can pose:
· A class may only pose as one of its direct or indirect superclasses
· The posing class must not define any new instance variables which are absent from the target class (though it may define or override methods).
· No messages must have been sent to the target class prior to the posing.
Posing, similarly to categories, allows globally augmenting existing classes. Posing permits two features absent from categories:
· A posing class can call overridden methods through super, thus incorporating the implementation of the target class.
· A posing class can override methods defined in categories.