When a new object is created and initialized why do we use id? Can’t we use (NSObject*)?
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.
Not every object in Objective C is
NSObject. There are other root classes (for example,NSProxy), that are not derived fromNSObject.idmeans absolutely any object. Everything is Objective C that can receive messages (includingClass) can be passed asidwithout type warnings.NSObject*is only useful on objects that are actually derived fromNSObject. If you pass something that is not derived from it, type checker will complain.