Skip to content

Instantly share code, notes, and snippets.

@hamadmj
Created November 10, 2015 21:12
Show Gist options
  • Save hamadmj/fdb02ff9ec7627389a48 to your computer and use it in GitHub Desktop.
Save hamadmj/fdb02ff9ec7627389a48 to your computer and use it in GitHub Desktop.
Challenge 2
#import "XYZAppDelegate.h"
@interface XYZParent : NSObject
@property (atomic) NSMutableArray *children;
@end
@implementation XYZParent
@end
@interface XYZChild : NSObject
@property (atomic) XYZParent *parent;
@end
@implementation XYZChild
@end
@implementation XYZAppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
XYZParent *parent = [[XYZParent alloc] init];
parent.children = [[NSMutableArray alloc] init];
for (int i = 0; i < 10; i++) {
XYZChild *child = [[XYZChild alloc] init];
child.parent = parent;
[parent.children addObject:child];
}
return YES;
}
@end
@amrabdelaal
Copy link

XYZChild class must inhert from XYZParent class

@interface XYZChild : XYZParent

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