Objective C uses a special keyword ‘id’.
Let’s see what it is.
Objective C -id- is actually a ‘pointer to an object’. That is ‘id’ can hold a pointer to any objective c object. It doesn’t matter the object’s class.

NSString *myString = @"Coderz Heaven!";
id newString;
NSString *tempString;

That’s it! It will work out with using ‘id’ keyword. Compiler simply thinks ‘you know what you are doing!’

A word of caution : Remember not to use * while creating id objects! Because that type already know it’s a pointer!


One Comment

  1. Diedre Marty June 21, 2011 at 9:27 pm

    I’d come to settle with you one this subject. Which is not something I typically do! I really like reading a post that will make people think. Also, thanks for allowing me to speak my mind!


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.