Re: strange semi-newbie issue SOLVED with questions
Re: strange semi-newbie issue SOLVED with questions
- Subject: Re: strange semi-newbie issue SOLVED with questions
- From: Andrew Kinnie <email@hidden>
- Date: Sun, 8 Feb 2004 20:13:53 -0500
Hmm. using a local variable worked (thanks enormously), and I imagine
using a local variable is better form.
In otherwords, the LineItem class has an instance variable called item,
and an accessor method for it with the same name (which I understood
was standard cocoa practice?). Why would [item price] not return the
same value each time? The textual stuff was just for debugging, but I
guess I don't understand what was wrong with what I did?
Thanks for your help, this has been annoying me for a couple days now.
Andrew
On Feb 8, 2004, at 7:24 PM, String wrote:
>
>
Problems w/my ISP and attachments... see below for working test xcode
>
project
>
Begin forwarded message:
>
>
> From: String <email@hidden>
>
> Date: February 8, 2004 5:54:38 PM CST
>
> To: Andrew Kinnie <email@hidden>
>
> Subject: Re: strange semi-newbie issue
>
>
>
> This code has expected results. I think the problem might be that
>
> you have price as a variable and a method.
>
>
>
>
>
> Also, you are sending a message to 'item' 3X to get the same value.
>
> Why not init a local variable and do it once ? Also, you are doing
>
> the math price * quantity 2X
>
>
>
> e.g.
>
> double p = [item price]
>
> NSLog(@....". p);
>
> NSLog("@...", q);
>
> double pq = p * q;
>
> NSLog("@...", pq);
>
> return pq;
_______________________________________________
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.