Search code examples
objective-cxcode4

Do all objects inherit from NSObject?


I know you can implement using Object class but is there any in Apple's Objective C?


Solution

  • Just about every Cocoa class inherits from NSObject. Even the slightly esoteric Block objects, whose class tree isn't public, have NSObject at the root.

    The only other root class that is publicly known in Cocoa is NSProxy, though it does conform to the NSObject protocol, which allows it to act in many ways like any other Cocoa object.