强制声明变量的协议-目标C [英] Protocol to force variable declaration - Objective C
本文介绍了强制声明变量的协议-目标C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在@protocol中声明变量?只是为了迫使程序员在实现类的(实现此协议的类)标头和实现中添加这些变量?
Is it possible to declare variable in @protocol? Just to force programmers to add those variable in implementing class's(classes which implements this protocol) header and implementation?
谢谢
推荐答案
简短的回答:不,不能这样做.您最多可以强制使用方法和属性.
Short answer: No, it isn't possible to do that. You can enforce the availability of methods and properties at most.
这篇关于强制声明变量的协议-目标C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文