1
범위 밖에서 선언 된 변수 앞에 static 키워드를 접두어로 붙이면 해당 변수가 외부에서 액세스 할 수 없습니다. 그러나 범주를 사용하는 범주에서 범위를 제한합니까?전역 변수에 대한 "정적"키워드 - 범위는 무엇입니까?
Foo.m
@implementation Foo
static void* FooContext = &FooContext;
- (void)methodThatUsesFooContext { ... }
@end
Foo+SpecialSauce.h
@implementation Foo (Special Sauce)
- (void)anotherMethodThatWouldLikeToUseFooContext { ... }
@end