Re: Object-C question #1
Re: Object-C question #1
- Subject: Re: Object-C question #1
- From: King Chung Huang <email@hidden>
- Date: Tue, 07 Dec 2004 21:10:45 -0700
You probably intended to send the parseString: message to yourself. If so, the initWithString: method should probably look something like this:
- (id)initWithString:(NSString *)string {
if (self = [super init]) {
[self parseString:string];
}
return self;
}
King Chung Huang
Learning Commons
University of Calgary
On Dec 7, 2004, at 8:18 PM, Mark Dawson wrote:
I have a Objective-C questions:
I have made a subclass of an NSObject and am getting a "parseString undeclared (first use in this function). If I remove the implementation of "parseString", I get the above error PLUS the error "parseString" implementation not found". What is my problem?
Thanks! Mark
@interface LengthParser : NSObject {
double mLengthValue;
int mErrorCode;
}
- (id)initWithString:(NSString *)aString;
- (int)parseString:(NSString *)aString;
@end
@implementation LengthParser
- (id)initWithString:(NSString *)aString
{
[parseString aString];
return self;
}
- (int)parseString:(NSString *)aString
{
mLengthValue = NAN;
mErrorCode = eLengthSuccess;
return mErrorCode; // never should get here?
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden