<% 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'封装性比较强,不会提示没有权限,直接说不支持属性或方法 %>
ASP类的写法
<% Class myClassName Private int_ID '分类id '类初始化 Private Sub Class_Initialize() m_strError = "" End Sub '类释放 Private Sub Class_Terminate() m_strError = "" End Sub '-----读写各个属性--------------------------- Public Property Get ID ID = int_ID End Property Public Property Let ID(intId) int_ID = intId End Property public Function method() End Function End Class %>