Are all objects inherited from NSObject?

I know that you can implement the Object class, but is there an Objective C in Apple?

+6
source share
2 answers

Almost every Cocoa class inherits from NSObject . Even slightly esoteric block objects whose class tree are not publicly available have an NSObject at the root.

The only other root class commonly known in Cocoa is NSProxy , although it conforms to NSObject , which allows it to act differently like any other Cocoa object.

+10
source

In theory, you can define a class that does not inherit from NSObject.

But in practice, it is so complicated that no one ever worries about it. NSObject does a lot of nice things for you.

+1
source

Source: https://habr.com/ru/post/908192/


All Articles