Re: Newbie: Cannot use object as a parameter to a method
Re: Newbie: Cannot use object as a parameter to a method
- Subject: Re: Newbie: Cannot use object as a parameter to a method
- From: Prachi Gauriar <email@hidden>
- Date: Thu, 22 Apr 2004 14:43:44 -0500
On Apr 22, 2004, at 2:04 PM, Michael S. Tashbook wrote:
- (NSString)rollAsString
{ // XCode reports the error here
return @"foo"; // Just a placeholder statement for now
}
This should be
- (NSString *)rollAsString, not - (NSString)rollAsString;
In Java, everything object is implicitly a pointer (or reference in
Java-speak), but in Objective-C, you have to explicitly use the
indirection operator (*) to specify that a variable points to an
instance of an object.
In other words, never just have NSString or NSArray, always have
NSString * or NSArray *.
-Prachi
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.