Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Created April 16, 2015 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolfbjarne/eb0238f7bf9a91b8c3cf to your computer and use it in GitHub Desktop.
Save rolfbjarne/eb0238f7bf9a91b8c3cf to your computer and use it in GitHub Desktop.
//
// AppDelegate.m
// simpletestapp
//
// Created by Rolf Bjarne Kvinge on 13/04/15.
// Copyright (c) 2015 Rolf Bjarne Kvinge. All rights reserved.
//
#import "AppDelegate.h"
@interface A : NSObject
-(instancetype) init;
-(instancetype) initToday;
@end
@interface B : A
-(instancetype) init;
-(instancetype) initToday;
@end
@implementation A
-(instancetype) init
{
NSLog (@"A init");
return [super init];
}
-(instancetype) initToday
{
NSLog (@"A initToday");
return [self init];
}
@end
@implementation B
-(instancetype) init
{
NSLog (@"B init");
return [super init];
}
-(instancetype) initToday
{
NSLog (@"B initToday");
return [super initToday];
}
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSLog (@"Test 1");
[[B alloc] init];
NSLog (@"Test 1 done");
NSLog (@"Test 2");
[[B alloc] initToday];
NSLog (@"Test 2 done");
return YES;
}
@end
Test 1
B init
A init
Test 1 done
Test 2
B initToday
A initToday
B init
A init
Test 2 done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment