Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
You use the id syntax when you're declaring a property or an instance variable so the compiler can warn you if you try to assign an object to the variable that doesn't conform to that protocol.
The compiler determines if that object conforms to the protocol based on the interface definition, not the init return type.
Plus, if you actually did have to do it the way you are asking about, imagine what your init declaration would look like for an object that conforms to several protocols!
I did't know about this init() method fact this great to know. I am java developer so i generally used this in java but i didi't use it in Objective C.
Replies
You use the id syntax when you're declaring a property or an instance variable so the compiler can warn you if you try to assign an object to the variable that doesn't conform to that protocol.
The compiler determines if that object conforms to the protocol based on the interface definition, not the init return type.
Plus, if you actually did have to do it the way you are asking about, imagine what your init declaration would look like for an object that conforms to several protocols!
Some of my code can be found on GitHub.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome