Simple question: is it fair to say that the ‘isa’ instance variable in Objective-C provides the same functionality as the ‘instanceof’ operator in Java?
Simple question: is it fair to say that the ‘isa’ instance variable in Objective-C
Share
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.
These are different concepts.
One is a member of a struct, while another is an operator.
To mimic a strict interpretation of the
instanceofoperator in Java, you can do pointer comparison on theisamember:But it is recommended that you use the
NSObjectprotocol’s-isMemberOfClass:method to accomplish this instead:If you are interested in knowing if the specified class is an instance of, or is a subclass of another class, you should use the
NSObjectprotocol’s-isKindOfClass:method.