|
ASP开发中的(VBScript)类基础学习(2) End Sub
'//---------------------------定义类的输出属性-------------------------------//
'//----定类的属性,该属性是让用户初始化strExapmle变量
Public Property Let setExapmle(ByVal strVar) strExapmle = strVar End Property
'//---------------------------定义类的输出属性-------------------------------//
'//----定义类的属性,该属性是返回一个版本号
Public Property Get Version Version = strVersion End Property
'//----定义类的属性,该属性是返回该类的作者号
Public Property Get Author Author = strAuthor End Property
'//----定义类的属性,该属性是返回一个版本号
Public Property Get Exapmle Exapmle = strExapmle End Property
End Class
</script> <%
'//-------这里是使用该类的例子
Dim oneNewClass
Set oneNewClass = New myClass
Response.Write "作者:" & oneNewClass.Author & "<br>" Response.Write "版本:" & oneNewClass.Version & "<br>"
oneNewClass.setExapmle = "这是一个简单类的例子"
Response.Write "用户自定义:" & oneNewClass.Exapmle & "<br>"
oneNewClass.Information
Set oneNewClass = Nothing
%>
ASP中的Session本身是可以储存对象的,它可以保存基本变量,数组,自动化对象(Automation Object)等,但在储存自定义类的对象时会碰到问题。
如下面的代码:
<%
|