Re: new class
Re: new class
- Subject: Re: new class
- From: PGM <email@hidden>
- Date: Thu, 20 Sep 2007 21:09:11 -0400
In a new class (subclass of NSObject) I have the following method:
- (DCPoint)convert { // gives this error: can not use an object
as parameter to a method
DCPoint * DC = [[DCPoint alloc] init];
// insert calculations here
[DC initWithDistance:0 Course:0];
return DC; // gives this error: incompatible types in return
}
Also note that you init DC twice, but alloc it only once. In
general, init should always be used concertedly with alloc. The line
before the return should most likely be divided into two lines where
you use setters to change the variables of DC:
[DC setDistance:0];
[DC setCourse:0];
Cheers, Patrick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >new class (From: H M <email@hidden>) |