objective-c - iOS通过property声明的变量的作用域??
巴扎黑
巴扎黑 2017-05-02 09:26:52
0
1
347

我们可以通过.h中使用property关键字声明变量,但是他的作用域是什么?,还可以在.m中的扩展接口声明变量。还可以在@implementation中声明变量,他们的作用域分别是什么?从使用中看,.h中通过property声明的变量应该是public,.m中@interface声明的是protected。是这样的吗?求解惑。

巴扎黑
巴扎黑

reply all(1)
Peter_Zhu

1. The key in OC is to see if you have obtained the declaration of the variable. Once you have obtained it, it can be used. In effect, it is public in .h and private in .m. Generally, you will not import the .m file. The @interface in .m is actually an extension. It is just written in the .m file and will automatically provide the implementation of the settergetter.
2. Because of the existence of runtime, private is meaningless. I don’t think you should look at OC with this kind of thinking.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!