Help with CurrencyConverter in DP4

Bill Chin bchin at mdimension.com
Sat Sep 2 22:36:13 PDT 2000


Alex Eager asked:
> Ideas as to why it doesn't work:

You needed to add:
#import "Converter.h"
after your first #import in ConverterController.m. That way the compiler  
can find the convertAmount: byRate: method that is declared in Converter.h.

> --- It seems like I never actually alloc and init converter.  It also seems 
> like I never tell it to be of type Converter.  Please tell me if it is right 
> and if it is, why don't I see any alloc or init in the project?  Does it do 
> it automatically?

You did alloc/init the Converter. You did it in InterfaceBuilder by  
pointing/clicking and  instantiating a Converter (which is actually done  
when the nib file is loaded). I wouldn't personally do it this way for this  
kind of object, but it is certainly valid (Converter never talks directly  
to the UI, so there really isn't any reason to have it in IB). But then  
that is probably outside the scope of the tutorial. You could certainly  
create a Converter object in your convert: method the first time convert:  
gets called and maintain a pointer to it if you wish (of course, don't  
forget to release it).

> P.S. If the project doesn't open after all this moving around, I'm very
> sorry for having troubled you.  Thanks for trying.

It would have been easier if you created a .tar.gz archive.

..Bill Chin
M Dimension Technology



More information about the MacOSX-dev mailing list