4
在Objective-C中,我很好奇如何實現像@private
,@protected
等實例變量的訪問控制。@private是如何實現的?
我認爲是在一些像這樣的方式產生不同的結構:
@interface Foo {
int bar;
@private
int baz;
@public
int qux;
}
=>
東西沿着
struct Class_Foo_Protected {
int bar;
};
struct Class_Foo_Private {
int baz;
};
struct Class_Foo_Public {
int qux;
};
但是我真的不知道該線。任何人都知道這是如何完成的?
非常有趣,謝謝。 – 2010-12-04 08:24:44