Re: CurrencyConverterTutorial.pdf
Re: CurrencyConverterTutorial.pdf
- Subject: Re: CurrencyConverterTutorial.pdf
- From: Tom Harrington <email@hidden>
- Date: Sun, 06 Jan 2002 22:09:25 -0700
Nobu wrote:
Compiling ConverterController.m
^ warning: cannot find class (factory) method.
^ warning: return type for 'convertAmount:atRate:' defaults to id
(s) incompatible types in assignment
--
- (IBAction)convert:(id)sender
{
float rate, amt, total;
amt = [dollarField floatValue];
rate = [rateField floatValue];
---Error--> total = [Converter convertAmount: amt atRate: rate];
This should read as follows:
total = [converter convertAmount: amt atRate: rate];
Note that it's "converter" and not "Converter".
It's a little confusing because you have a class "Converter" and an
instance "converter", which look nearly identical. By using "Converter"
you're telling the compiler to look for a method +convertAmount:atRate
when what you actually have is -convertAmount:atRate.
In other languages this'd be an error, but in objective C it's not
necessarily wrong.
--
Tom Harrington, Cybernetic Entomologist
email@hidden