Silver Challenge: Another initializer


#1

Hello,

Another initializer created:

[code]-(id)initWithItemName:(NSString *)myItemName
serialNumber:(NSString *)mySerialNumber
{
self = [super init];

if (self) {
    [self setItemName:myItemName];
    [self setSerialNumber:mySerialNumber];
}
return self;

}[/code]

Since another initializer is NOT the designated initializer I do NOT implement code below right?
Code below would be necessary if another initializer would become my designated initializer correct?

-(id)init { return [self initWithItemName:@"Default Value" serialNumber:@""]; }


#2

Well, you have a designated initializer already, initWithItemName:serialNumber:valueInDollars:, and this new initializer is not taking over the designated status, so it must call the designated init:

-(id)initWithItemName:(NSString *)myItemName
         serialNumber:(NSString *)mySerialNumber
{
      return [self initWithItemName:myItemName serialNumber:mySerialNumber valueInDollars:0];
}