开发者

Why CGSize doesn't use * when declaring variables?

When I create an instance of a class called, say, Sprite, I do something like:

Sprite *mySprite = [[Sprite alloc]开发者_JS百科init];

But why when creating a CGSize or int type variable, I can't use *? Basically, what's the * for?


The * denotes a pointer. CGSize is declared as a struct and Sprite is a class, and in Objective-C all classes are referenced by a pointer.


You can find additional information in the Programming with Objective-C documentation. The relevant sections are Use Pointers to Keep Track of Objects and Methods Can Return Values.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜