类与模块 [英] Classes vs. Modules

查看:71
本文介绍了类与模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读过关于此的文档,但有一点不清楚。似乎

好​​像模块不必完全合格。这是

案吗?我有源显然已经显示了这个。


模块是否从VB6中遗留下来,并且不再使用了多少?似乎

最好要求Imports或在其他类/模块中使用完全限定名称的

函数,但是模块不要求这样做,

混乱全局命名空间。似乎使用共享的类

函数/ subs更好。


有什么建议吗?


Zytan

解决方案

2月9日下午3:15,Zytan < zytanlith ... @ yahoo.comwrote:


我已经阅读了关于此的文档,但有一点不清楚。似乎

好​​像模块不必完全合格。这是

案吗?我有源显然已经显示了这个。


模块是否从VB6中遗留下来,并且不再使用了多少?似乎

最好要求Imports或在其他类/模块中使用完全限定名称的

函数,但是模块不要求这样做,

混乱全局命名空间。似乎使用共享的类

函数/ subs更好。


有什么建议吗?


Zytan



我有时候还会使用模块来表示全局变量和函数......我认为这是前一段时间在这个组中提到的(搜索它,我是

不确定)模块实际上被编译成静态类与

共享的静态成员和函数......


" Zytan" < zy ********** @ yahoo.comschrieb


我已经阅读了关于此的文档,但有一点不清楚。它似乎
似乎模块不必完全合格。

这种情况​​呢?我有源显然已经显示了这个。


模块是否从VB6中遗留下来,并且不再使用了多少?似乎

最好要求Imports或使用完全限定名称

用于其他类/模块中的函数,但模块不需要

这会弄乱全局命名空间。似乎使用了一个带有

的类共享函数/ subs更好。


有什么建议吗?



已经讨论了大约1百万次,所以请先搜索这个组。
http://groups.google.com/groups /sear...ject%3Amodule*

Armin


我有时候还会使用模块来表示全局变量函数... I


认为它刚刚在这个组中被提及(搜索它,我是

不确定)模块实际上被编译成静态类与

共享静态成员和函数...



好​​的。这很有意思。


我尽量避免像瘟疫这样的全球大战,就像大多数人一样,所以我不能这么做,因为我不能想要为什么有人还想要用这个。如果你有一个

''全局变量'',那么至少在一个类中似乎更好,在那里你将b $ b限制在一个特定的位置。


Zytan


I''ve read the docs on this, but one thing was left unclear. It seems
as though a Module does not have to be fully qualified. Is this the
case? I have source that apparently shows this.

Are modules left-over from VB6, and not much used anymore? It seems
that it is better to require Imports or use fully qualified names for
functions in other classes/modules, but a Module doesn''t require this,
cluttering the global namespace. It seems using a class with shared
functions/subs is better.

Any recommendations?

Zytan

解决方案

On Feb 9, 3:15 pm, "Zytan" <zytanlith...@yahoo.comwrote:

I''ve read the docs on this, but one thing was left unclear. It seems
as though a Module does not have to be fully qualified. Is this the
case? I have source that apparently shows this.

Are modules left-over from VB6, and not much used anymore? It seems
that it is better to require Imports or use fully qualified names for
functions in other classes/modules, but a Module doesn''t require this,
cluttering the global namespace. It seems using a class with shared
functions/subs is better.

Any recommendations?

Zytan

I still sometimes use modules for global variables and functions... I
think it was mentioned a while ago in this group (search for it, I''m
not sure) that Modules actually get compiled into static classes with
shared static members and functions...


"Zytan" <zy**********@yahoo.comschrieb

I''ve read the docs on this, but one thing was left unclear. It
seems as though a Module does not have to be fully qualified. Is
this the case? I have source that apparently shows this.

Are modules left-over from VB6, and not much used anymore? It seems
that it is better to require Imports or use fully qualified names
for functions in other classes/modules, but a Module doesn''t require
this, cluttering the global namespace. It seems using a class with
shared functions/subs is better.

Any recommendations?

It''s been discussed about 1 mio times, so please search this group first.
http://groups.google.com/groups/sear...ject%3Amodule*
Armin


I still sometimes use modules for global variables and functions... I

think it was mentioned a while ago in this group (search for it, I''m
not sure) that Modules actually get compiled into static classes with
shared static members and functions...

Ok. That''s interesting.

I try to avoid global vars like the plague, as do most, so I cannot
see why anyone would still want to use this. If you''re gonna have a
''global var'', it seems better to at least be in a class, where you
confine it to a certain location.

Zytan


这篇关于类与模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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