November 2013
Beginner
325 pages
9h 47m
English
Create a new file: a subclass of BNRAppliance named BNROwnedAppliance. In BNROwnedAppliance.h, add a mutable set of owner names and three methods.
#import "BNRAppliance.h"
@interface BNROwnedAppliance : BNRAppliance
@property (readonly) NSSet *ownerNames;
- (instancetype)initWithProductName:(NSString *)pn
firstOwnerName:(NSString *)n;
- (void)addOwnerName:(NSString *)n;
- (void)removeOwnerName:(NSString *)n;
@end
Notice that one of the methods that you have declared is an initializer that takes two arguments.
Implement the methods in BNROwnedAppliance.m:
#import "BNROwnedAppliance.h"
@interface BNROwnedAppliance ()
{
NSMutableSet *_ownerNames;
}
@end
@implementation BNROwnedAppliance
- (instancetype)initWithProductName:(NSString ...Read now
Unlock full access