Quantcast
Channel: Why use id when we can just use NSObject? - Stack Overflow
Browsing all 5 articles
Browse latest View live

Answer by 9dan for Why use id when we can just use NSObject?

typedef struct objc_object { Class isa;} *id;Above is the actual definition of the id in Objective-C language. Objective-C runtime system is built around id and Class. Nothing have to do with NSObject...

View Article



Answer by Jasarien for Why use id when we can just use NSObject?

every object is a subclass of NSObjectThat is an incorrect statement. You can create objects that do not inherit from NSObject. it's not really recommended, but it is possible.NSProxy is an example -...

View Article

Answer by justin for Why use id when we can just use NSObject?

id erases the type and it is equivalent to saying "this object responds to any selector visible to the translation". Of course, it is your responsibility to make sure your program is correct when you...

View Article

Answer by James Webster for Why use id when we can just use NSObject?

every object is a subclass of NSObjectThat's not correct. You could make an object that extends from nothing as a root class.That's perhaps why id was introduced.

View Article

Why use id when we can just use NSObject?

I know that when we want to create an unknown value object we use id. However, I'm curious that why did Apple to choose id which decides it's value during runtime, when every object is a subclass of...

View Article

Browsing all 5 articles
Browse latest View live




Latest Images