Ans : id is a generic type. This means that the compiler will expect any object type there, and will not enforce restrictions. It can be useful if you're expecting to use more than one class of objects there. So you can add anything of type id to an NSArray.
Usage :
bool bVal = [arr containObject:@5];
So array method containObject has id type as parameter.
- (BOOL)containsObject:(ObjectType)anObject;
Usage :
bool bVal = [arr containObject:@5];
No comments:
Post a Comment
Thanks