Quote:
Originally Posted by anmldr
I am trying to understand what a star is used for... *
In the first after NSEvent there is a * and closed parenthesis. In the second, there is no star. It is hard to look up "*" in any documentation.
-(void)mouseDown: (NSEvent *)event {
//my code
}
-(void)drawRect: (NSRect)rect {
//my code
}
Thanks,
Linda
|
I may be bad at explaining it, but my understanding of how this works is that the *asterisk is used when declaring or referring to Objective C Objects. It isn't used when declaring things like int, double, float, NSRect (c struct), and the like. So if that thing you are declaring is an object, like an NSString, NSArray, UITableView (objects) use the asterisk, but when you are declaring C primitives such as int, double, float, etc... (primitives might not be the right word). The only exception I've seen regarding this rule is when you declare and object that is of the type "id" which is like a catch all object.
I think the *asterisk means that it's pointing to a location in memory of where that object will reside.
Someone will probably correct my explanation, but if you follow the rules I basically listed above, you won't go wrong.