Challenge question


#1

I am currently pulling my hair out with an error I am receiving when trying to run my code for the CHPT 18 challenge problem. As discussed in a recent chapter, it is preferred to use [self var] instead of just var. Because of this I setup my ForeignStockHolding subclass to call the conversion rate variable as [self conversionRate], yet when I do this I get an error stating “No visible @interface for ‘ForeignStockHolding’ declarers the selector 'conversionRate”. Below is my code
ForeignStockHolding.h

[code]#import <Foundation/Foundation.h>
#import “StockHolding.h”

@interface ForeignStockHolding : StockHolding
{
float conversionRate;
}
@property float conersionRate;

  • (float)costInDollars;
  • (float)valueInDollars;

@end
[/code]

ForeignStockHolding.m

[code]#import “ForeignStockHolding.h”

@implementation ForeignStockHolding
@synthesize conersionRate;

-(float)costInDollars
{
float rate = [self conversionRate]; //error here
return [super costInDollars] * rate;
}

-(float)valueInDollars
{
float rate = [self conversionRate]; //error here
return [super valueInDollars] * rate;
}

@end
[/code]

any help would be greatly appreciated!