Synthesized automatically? CHALLENGE 22

I couldn’t figure out what I missed but my code seems synthesized automatically somehow…
I appreciate any help :slight_smile:

Thanks,

BNRPortfolio.h

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

@interface BNRPortfolio : NSObject

@property(nonatomic, copy) NSArray *holdings;

  • (float)totalValue;
  • (void)addStock:(BNRStockHolding *)stockHolding;
  • (void)removeStock:(unsigned int) i;

@end[/code]

BNRPortfolio.m

[code]#import “BNRPortfolio.h”
#import “BNRStockHolding.h”

@interface BNRPortfolio()
{
NSMutableArray *_holdings;

}
@end

@implementation BNRPortfolio

  • (void)holdings:(NSArray *)a
    {
    _holdings = [a mutableCopy];
    }

  • (NSArray *)setHoldings
    {

    return [_holdings copy];

}

  • (float)totalValue
    {
    float total = 0;

    for (int i = 0; i < 3; i++)
    {
    float currentValue = [_holdings[i] valueInDollars];
    total += currentValue;
    }

    return total;
    }

  • (void)addStock:(BNRStockHolding *)stockHolding
    {
    if (!_holdings)
    {
    _holdings = [[NSMutableArray alloc] init];
    }

    [_holdings addObject:stockHolding];

}

  • (void)removeStock:(unsigned int)i
    {
    if (_holdings)
    {
    [_holdings removeObjectAtIndex:i];

    }

}

@end[/code]

main.m

[code]#import <Foundation/Foundation.h>
#import “BNRStockHolding.h”
#import “BNRForeignStockHolding.h”
#import “BNRPortfolio.h”

int main(int argc, const char * argv[])
{

@autoreleasepool {

    BNRStockHolding *stock1 = [[BNRStockHolding alloc]init];
    BNRStockHolding *stock2 = [[BNRStockHolding alloc] init];
    BNRForeignStockHolding *stock3 = [[BNRForeignStockHolding alloc] init];

    stock1.purchaseSharePrice = 2.30;
    stock1.currentSharePrice = 4.50;
    stock1.numberOfShares = 40;
    stock1.symbol = @"XYZ";

    stock2.purchaseSharePrice = 12.19;
    stock2.currentSharePrice = 10.56;
    stock2.numberOfShares = 90;
    stock2.symbol = @"ABC";

    stock3.purchaseSharePrice = 45.10;
    stock3.currentSharePrice = 49.51;
    stock3.numberOfShares = 210;
    stock3.conversionRate = 0.94;
    stock3.symbol = @"LMN";


    NSMutableArray *mutable = [NSMutableArray array];
    [mutable addObject:stock1];
    [mutable addObject:stock2];
    [mutable addObject:stock3];

    BNRPortfolio *portfolio = [[BNRPortfolio alloc] init];
    portfolio.holdings = [mutable copy];

    float totalAmount = [portfolio totalValue];

    NSLog(@"total amount is %f",totalAmount);[/code]

I am very new to this, have restarted the book for the 3rd time.
I found an awesome page that breaks the property, synthesize stuff down in very clear detail. It helped me break through at least that barrier. This is tough stuff!
useyourloaf.com/blog/2012/08/01/ … dot-4.html