在另一个引用另一个类 [英] Referencing a Different Class in Another
本文介绍了在另一个引用另一个类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有
攻击值
防御价值
在一堂课中,我所有的武器都在另一堂课中,我可以在另一堂课中进行引用吗?还是它们都需要在同一堂课中才能调整其值?
in one class, and all of my Weapons in another, can I reference one in another, or do they all need to be in the same class to adjust their values?
推荐答案
我们可能需要更多细节,并可能需要一些示例代码.
We will probably need a trifle more details and perhaps some sample code.
通常,您应该通过公共属性或方法来访问这些值.
Generally, you should make those values accessible via public properties or methods.
这篇关于在另一个引用另一个类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文