Reputation: 349
Let's say I have two protocols
@protocol Playlist<NSObject>
@property(nonatomic, copy) NSString *title;
@property(nonatomic, assign) NSUInteger trackCount;
@end
and another as
@protocol Album<NSObject>
@property(nonatomic, copy) NSString *name;
@property(nonatomic, assign) NSUInteger trackCount;
@end
and there is a class which conforms to these protocols
.h file
@interface MusicLibrary <Playlist, Album>
@end
.m file
@implementation MusicLibrary
@synthesize title;
@synthesize name;
@synthesize trackCount;
@end
Which trackCount property will it refer to? Can I use trackCount twice?
It surely do not give any compile time error.
Upvotes: 0
Views: 201
Reputation: 8563
It looks to me that you are modeling your data wrong. The way you have it setup a musicLibrary is BOTH a playlist and an album. I think a more correct model would have a MusicLibrary containing many playlist and many albums. Something like:
@property (nonatomic, strong) NSArray<Album>* albums;
@property (nonatomic, strong) NSArray<Playlist>* playlists;
Upvotes: 0