Alright, it’s been a long time since I’ve worked with pointers. And now I’ve been writing .NET code for more than a decade so I haven’t had to deal with them. In fact, in .NET it’s really nice because if it’s not a value type then it’s clearly a reference type, or by definition a pointer.
So, in .NET when I declare a string it’s most certainly a pointer underlying because it’s a reference type:
string s = "Hello Mike!";
However, it appears that in Objective-C I can declare a string two different ways:
NSString* s = "Hello Mike!";
NSString s = "Hello Mike!";
Now, if I’m understanding this correctly the first declaration is very similar to the underlying declaration of a string in .NET, a pointer. But what exactly is the second?
Now bear in mind I may be way off base here because I’m just starting to dig into Objective-C, so please excuse my ignorance!
Coming from REALbasic to Objective-C was similar for me: they both use pointers as references to object instances, but in REALbasic that fact is implicit, whereas Objective-C is C and therefore must make it explicit. That fact, however, is really just an accident of notation. The implications, for things like assignment and comparison, are similar.
You might be helped by reading the relevant entry from my book on this topic:
http://www.apeth.com/iOSBook/ch03.html#_an_instance_reference_is_a_pointer
(The fact that you don’t seem to understand yet how to form an NSString literal (it starts with an at-sign, e.g.
@"hello", is secondary.)