Re: a newbie question
Re: a newbie question
- Subject: Re: a newbie question
- From: Ken Thomases <email@hidden>
- Date: Sat, 15 Nov 2008 18:51:26 -0600
So far, nobody that I've seen has pointed out the specific error in
the code:
On Nov 10, 2008, at 9:00 PM, Michael wrote:
Fraction *myFraction;
myFraction= [Fraction alloc];
myFraction= [Fraction init]; /* ??? */
You are calling init on the class Fraction, not on the instance that
you've allocated. The last line should have been written as:
myFraction = [myFraction init];
although, as mentioned, it's customary to always initialize the
allocated instance within the same expression where it was allocated,
with this pattern:
myFraction = [[Fraction alloc] init];
Cheers,
Ken
_______________________________________________
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