If you have object.name
you are calling a method called name
on object
. This method may access an instance variable that it then returns, but it is a method, so it can do whatever it is written to do. Objective-C Synthesises methods for properties, so you may not have actual Objective-C code, but the methods still exist and can be overridden.
With object->name
you are access the instance variable name
of object
. This is a direct access to the memory of object
thus there is no method call and nothing to implement / override.
In general, for object's, you should use object.name
to access the property unless there is a specific reason no to do this.
As a note, when you reference an instance variable inside of an object itself it is dereferencing self
implicitly, i.e. name
is the same as self->name
.