开发者

Variables inside protocols in Objective-C

开发者 https://www.devze.com 2023-02-23 16:32 出处:网络
Why is there a provision to include a variable inside a protocol declaration, w开发者_StackOverflow社区hen is this ever used.

Why is there a provision to include a variable inside a protocol declaration, w开发者_StackOverflow社区hen is this ever used.

@protocol SampProtocol
int i;
- (void)func;
@end


There isn't any such provision. clang issues an error if you try to compile that code; gcc considers the int i; statement as part of the parent scope (which is probably a bug).

0

精彩评论

暂无评论...
验证码 换一张
取 消