Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
@interface BananaBox : NSObject
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;
@implementation AppleCart
NSMutableArray *_bananas;
-(id) init {
self = [self init]
if (self} {
_bananas = [[NSMutableArray alloc] init];
return self;
- (id)objectAtIndexedSubscript:(NSUInteger)idx {
return _bananas[idx];
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx {
_bananas[idx] = obj;
BananaBox *bananaBox = [[BananaBox alloc] init];
bananaBox[0] = @"Delicious banana";
bananBox[0]; // Returns "Delicious banana"

instead of @implementation AppleCart should be @implementation BananaBox, right?
There is typo in bananBox[0];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment