문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top