Home > DeveloperSection > Interviews > What is posing in iOS?

Posted on    August-06-2015 11:19 PM

 iPhone iPhone  Ios  Objective C 
 1 Answer(s)
  1469  View(s)
Rate this:

Tarun Kumar

Total Post:107

Posted on    August-06-2015 11:19 PM

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.

Modified On Aug-06-2015 11:22:02 PM

Don't want to miss updates? Please click the below button!

Follow MindStick