According to this answer, which says
NSString *string = [NSString new]; // A variable string referring a string object;
string = @"john"; // The object, string refers to is now "string"
Theoretically NSString is a class and string is an object which is given memory by [NSString new] code, Along with this I have read somewhere that in Objective-C, We always have pointer objects.
I am trying to understand it in real life example, Suppose I go to Toyota Agency (NSString Class) to purchased Toyota Prius(String object). And now I have my school bag(john) left is the car which is in my basement parking.
- So string is a Pointer Object or Pointer variable, Is this my Prius ?
- Is it referring to object in memory, memory is garage or Agency ?
Can any one please help to make it clear How an variable, pointer and object are related to each other ?