What is the diference between these two methods belonging to the NSSet class:
-(BOOL)containsObject:(id)anObject
-(id)member:(id)object
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The answer lies in the return values. containsObject returns a YES or a NO depending on if the object you send belongs to that particular set.
member returns id, which means that it returns the actual object if that object is part of the set.
As an example, you have an NSSet, aSet, with anObject. anObject belongs to the set.
If anObject does not exist in aSet: