I am bit confused, as my title mentioned,
Is id
in Objective C is primitive data type? or Object type? I always thought that id
is Object type as it is pointing towards an object.
So, Is it Object type or Primitive data type?
Definitly not a primitive type. From Apple:
In Objective-C, object identifiers are of a distinct data type: id. This type is the general type for any kind of object regardless of class and can be used for instances of a class and for class objects themselves.
id
is declared in objc.h as
typedef struct objc_object {
Class isa;
} *id;
so yes, I'd say it's primitive (pointers are primitive types in C).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With