全局变量声明 [英] Global variable declaration

查看:93
本文介绍了全局变量声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




全局变量在类定义之前和应用程序声明的模块之后声明。


请纠正我,如果我错了。


谢谢

PSB

Hi,

Global variables are declared before the class definition and after the modules of the application declaration.

Please correct me if I am wrong.

Thanks
PSB

推荐答案

我声明了一个全局变量Module.I必须在另一个类/类方法中使用这个全局变量。


任何人都可以通过解释示例代码来帮助我。


提前致谢

PSB
I have a global variable declared in the Module.I have to make use of this global variable in another class/ class method.

Could anybody help me by explainning the sample code.

Thanks in advance
PSB



我在Module中声明了一个全局变量。我有在另一个类/类方法中使用这个全局变量。


任何人都可以通过解释示例代码来帮助我。


谢谢你提前

PSB
I have a global variable declared in the Module.I have to make use of this global variable in another class/ class method.

Could anybody help me by explainning the sample code.

Thanks in advance
PSB



使用来自另一个类/方法/函数的全局变量,只需包含global和global。该类/方法/函数中的关键字。

to use global variable from another class/method/function, just include the "global" keyword in that class/method/function.



我在Module中声明了一个全局变量。我必须使用这个全局变量另一个类/类方法中的变量。


任何人都可以通过解释示例代码来帮助我。


提前谢谢

PSB
I have a global variable declared in the Module.I have to make use of this global variable in another class/ class method.

Could anybody help me by explainning the sample code.

Thanks in advance
PSB



虽然我强烈推荐AGAINST gobals,但可变类型将在模块之间传递:

While I highly recommend AGAINST gobals, mutable types will pass between modules:

展开 | 选择 | 换行 | 行号


这篇关于全局变量声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆