forked from bestswifter/MySampleCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParent.m
More file actions
34 lines (27 loc) · 737 Bytes
/
Parent.m
File metadata and controls
34 lines (27 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Parent.m
// load
//
// Created by 张星宇 on 16/2/1.
// Copyright © 2016年 zxy. All rights reserved.
//
#import "Parent.h"
static int someNumber = 0;
static NSMutableArray *someObjects;
@implementation Parent
+ (void)load {
NSLog(@"Load Class Parent");
}
+ (void)initialize {
NSLog(@"Initialize Parent, caller Class %@", [self class]);
}
/**
* 下面这个才是正确的initialize方法的实现,需要判断是不是由自己这个类调用的。
*/
+ (void)initializeCorrect {
if (self == [Parent class]) {
someObjects = [[NSMutableArray alloc] init]; // 不方便编译期复制的对象在这里赋值
NSLog(@"Initialize Parent, caller Class %@", [self class]);
}
}
@end