首页 > 开发 > Asp > 正文

ASP中的面向对象类

2020-06-20 13:15:02
字体:
来源:转载
供稿:网友

复制代码 代码如下:
<%
class MyClass
Dim var '公共变量必须使用Dim
Private var2'私有变量不需要

Sub sub1
response.write var2
End Sub

Private Sub sub2
response.write var
End Sub

Sub SetVar(v)
var2=v
End Sub
end class
Set cls = new MyClass'产生对象用set
cls.SetVar("asd")
cls.var = 1
cls.sub1'封装性比较强,不会提示没有权限,直接说不支持属性或方法
%>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表