• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
明天会更好!
博客园    首页    新随笔    联系   管理    订阅  订阅

我的第一个asp 类,练习

asp 类 第一个例子 不断学习中!

 

<%
Class myClass
' 声明myClass 的私有变量
Private strAuthor
Private strVersion
Private strExample
'初始化
   '构造函数在类声明时被调用
   ' set newclass = myClass
Private Sub Class_Initialize()
    strAuthor 
= "gbsck"
    strVersion 
= "1.0"
    response.write strAuthor
    response.write 
":"&strVersion
    Response.write 
"<br>myClass开始了<br>"

End Sub 
'析构
   '1 set newclass = nothing 时被调用
   '2 在页面结束时被掉用
Private Sub Class_Terminate()
    Response.write 
"<br>myclass结束了<br>"
End Sub 

Public Sub Information()
    Response.write 
"<br><a href="" http://gbsck.cnblogs.com"">gbsck</a><br>"
End Sub 


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 
%
>

<%
'//-------这里是使用该类的例子
Dim oneNewClass
Set oneNewClass = New myClass
Response.Write 
"作者: "& oneNewClass.Author &" <br>"
Response.Write 
"版本: "& oneNewClass.Version &" <br>"
oneNewClass.setExapmle 
= "这是一个简单类的例子"
Response.Write 
"例子: "& oneNewClass.Exapmle &" <br>"
'Response.Write "用户自定义:" & oneNewClass.Exapmle &" <br>"
oneNewClass.Information
Set oneNewClass = Nothing
%
>
posted @ 2007-08-03 18:19  小老好  阅读(161)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3