本文介绍了在Objective-C中"@public"是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在阅读了关于@private的问题之后,我知道了作品.但是,由于所有变量默认都为@protected,并且您不能在不定义访问器的情况下真正访问变量,所以@public到底是做什么的?您什么时候使用它?
After reading a question on @private I understand how that works. However, since all variables default to @protected and you cannot really access a variable without defining an accessor, what exactly does @public do? When would you use it?
推荐答案
何时使用?需要时为public
.要从该类外部访问它(没有任何额外的访问器),就是这样. :)
When would you use it? When you need it to be public
. To access it from outside that class (without any extra accessors), that is. :)
这篇关于在Objective-C中"@public"是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!