Deprecated NSObject Methods
A method identified as deprecated has been superseded and may become unsupported in the future.
Deprecated in OS X v10.5
Causes the receiving class to pose as a specified superclass. (Deprecated in OS X v10.5.)
A superclass of the receiver.
The receiver takes the place of aClass in the inheritance hierarchy; all messages sent to aClass will actually be delivered to the receiver. The receiver must be defined as a subclass of aClass. It can’t declare any new instance variables of its own, but it can define new methods and override methods defined in aClass. The
poseAsClass: message should be sent before any messages are sent to aClass and before any instances of aClass are created.
This facility allows you to add methods to an existing class by defining them in a subclass and having the subclass substitute for the existing class. The new method definitions will be inherited by all subclasses of the superclass. Care should be taken to ensure that the inherited methods do not generate errors.
A subclass that poses as its superclass still inherits from the superclass. Therefore, none of the functionality of the superclass is lost in the substitution. Posing doesn’t alter the definition of either class.
Posing is useful as a debugging tool, but category definitions are a less complicated and more efficient way of augmenting existing classes. Posing admits only two possibilities that are absent from categories:
A method defined by a posing class can override any method defined by its superclass. Methods defined in categories can replace methods defined in the class proper, but they cannot reliably replace methods defined in other categories. If two categories define the same method, one of the definitions will prevail, but there’s no guarantee which one.
A method defined by a posing class can, through a message to
super, incorporate the superclass method it overrides. A method defined in a category can replace a method defined elsewhere by the class, but it can’t incorporate the method it replaces.
Posing is deprecated in OS X v10.5. The
poseAsClass: method is not available in 64-bit applications in OS X v10.5.
- Available in OS X v10.0 and later.
- Deprecated in OS X v10.5.
© 2013 Apple Inc. All Rights Reserved. (Last updated: 2013-01-28)