我的课 [英] My Class

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

问题描述

当我创建自己的类时,要使用该类的功能,我必须创建该类的对象然后我可以访问该类的功能

级,


例如:


dim obj1 as myclass

obj1 = new myclass

obj1.myfunction(" parameter")

但是,当我使用.net类时,例如字符串我不需要创建一个

对象,我可以直接使用它吗?


例如


x = strings.left(" abc",2)


我该怎么办,以便我的课程的功能也可以访问

in同样的时尚..例如


myclass.myfunction(" parameter")

When I create my own class, to use the functions of that class I have to
create an object of that class and then I can access the functions of that
class,

for example:

dim obj1 as myclass
obj1 = new myclass
obj1.myfunction("parameter")

However, when I use .net class e.g. strings I do not need to create a
object, I can directly use it?

e.g.

x = strings.left("abc",2)

What do I have to do, so that the functions of my class can also be accessed
in the same fashion.. e.g.

myclass.myfunction("parameter")

推荐答案

拿一个看看静态和共享关键字。这两个中的一个应该

为你做这个。你正在寻找的是一个非实例化的课程

界面。


Mike Ober。


" patang" < PA **** @ discussions.microsoft.com>在消息中写道

新闻:49 ********************************** @ microsof t.com ...
Take a look at the "static" and "shared" keywords. One of these two should
do this for you. What you''re looking for is a non-instanced class
interface.

Mike Ober.

"patang" <pa****@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
当我创建自己的类时,要使用该类的函数,我必须创建该类的对象,然后我可以访问该类的函数
上课,

例如:

dim obj1 as myclass
obj1 = new myclass
obj1.myfunction(" parameter")

然而,当我使用.net类时,例如字符串我不需要创建一个
对象,我可以直接使用它吗?

x = strings.left(" abc",2)

我需要做什么,这样我的班级的功能也可以以同样的方式访问
..例如

myclass.myfunction(& ;参数")
When I create my own class, to use the functions of that class I have to
create an object of that class and then I can access the functions of that
class,

for example:

dim obj1 as myclass
obj1 = new myclass
obj1.myfunction("parameter")

However, when I use .net class e.g. strings I do not need to create a
object, I can directly use it?

e.g.

x = strings.left("abc",2)

What do I have to do, so that the functions of my class can also be accessed in the same fashion.. e.g.

myclass.myfunction("parameter")






看看静态和静态和共享关键字。这两个中的一个应该

为你做这个。你正在寻找的是一个非实例化的课程

界面。


Mike Ober。


" patang" < PA **** @ discussions.microsoft.com>在消息中写道

新闻:49 ********************************** @ microsof t.com ...
Take a look at the "static" and "shared" keywords. One of these two should
do this for you. What you''re looking for is a non-instanced class
interface.

Mike Ober.

"patang" <pa****@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
当我创建自己的类时,要使用该类的函数,我必须创建该类的对象,然后我可以访问该类的函数
上课,

例如:

dim obj1 as myclass
obj1 = new myclass
obj1.myfunction(" parameter")

然而,当我使用.net类时,例如字符串我不需要创建一个
对象,我可以直接使用它吗?

x = strings.left(" abc",2)

我需要做什么,这样我的班级的功能也可以以同样的方式访问
..例如

myclass.myfunction(& ;参数")
When I create my own class, to use the functions of that class I have to
create an object of that class and then I can access the functions of that
class,

for example:

dim obj1 as myclass
obj1 = new myclass
obj1.myfunction("parameter")

However, when I use .net class e.g. strings I do not need to create a
object, I can directly use it?

e.g.

x = strings.left("abc",2)

What do I have to do, so that the functions of my class can also be accessed in the same fashion.. e.g.

myclass.myfunction("parameter")






我想你在谈论SHARED成员。在声明您的成员时使用SHARED关键字

。您应该能够访问该类成员

而不首先实例化实际对象。


希望这会有所帮助:o)


" patang"写道:
I think you are talking about SHARED members. Triy using the SHARED keyword
when declaring your member. You should be able to access that class member
without instantiating an actual object first.

Hope this helps :o)

"patang" wrote:
当我创建自己的类时,要使用该类的功能,我必须创建该类的对象,然后我可以访问该类的功能
上课,

例如:

dim obj1 as myclass
obj1 = new myclass
obj1.myfunction(" parameter")

然而,当我使用.net类时,例如字符串我不需要创建一个
对象,我可以直接使用它吗?

x = strings.left(" abc",2)

我需要做什么,这样我的课程的功能也可以同样的方式访问


myclass.myfunction(& ;参数)
When I create my own class, to use the functions of that class I have to
create an object of that class and then I can access the functions of that
class,

for example:

dim obj1 as myclass
obj1 = new myclass
obj1.myfunction("parameter")

However, when I use .net class e.g. strings I do not need to create a
object, I can directly use it?

e.g.

x = strings.left("abc",2)

What do I have to do, so that the functions of my class can also be accessed
in the same fashion.. e.g.

myclass.myfunction("parameter")



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

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