@interface A : NSObject
@end
@implementation A
+ (void)initialize {
if ([self isSubclassOfClass:[A class]]) {
NSLog(@"HEHE");
}
if (self == [A class]) {
NSLog(@"HAHA");
}
}
@end
@interface B : A
@end
@implementation B
@end
int main(int argc, const char * argv[]) {
B *b = [[B alloc] init];
return 0;
}
// Что будет в консоли?
// а) Ничего
// а) HEHE
// а) HEHE, HAHA, HEHE
// в) HEHE, HAHA
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.