The Objective-C syntax [x foo]
is equivalent to C's x->foo()
, and x
is a pointer. Objective-C variables are always pointers; and objects are never variables -- they can only be managed through a pointer.
Why can't I dereference pointer to objects?
-
30-06-2022 - |
Question
Why can't I dereference pointers to objects or why aren't pointers to objects dereferenced?
myClass * object = [[myClass alloc]init];
[*object instanceMethod]; //Like this
[object instanceMethod]; //Instead of this
cause sending messages needs classes/objects as their receiver.
Thanks.
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow