对VBS类有兴趣的进来!有分!

YJBOLD 2005-04-05 08:14:41
这几天研究了VBS类,搞不懂这条语句:
property set ...
property get 是取属性值,property let 是给属性赋值,那这个property set是干什么的?
...全文
230 32 打赏 收藏 转发到动态 举报
写回复
用AI写文章
32 条回复
切换为时间正序
请发表友善的回复…
发表回复
raas 2005-04-09
  • 打赏
  • 举报
回复
up
YJBOLD 2005-04-09
  • 打赏
  • 举报
回复
up
YJBOLD 2005-04-07
  • 打赏
  • 举报
回复
up
mayi545 2005-04-07
  • 打赏
  • 举报
回复
UP
YJBOLD 2005-04-07
  • 打赏
  • 举报
回复
up
yjbnew 2005-04-07
  • 打赏
  • 举报
回复
up
xilo 2005-04-06
  • 打赏
  • 举报
回复
mark
yjbnew 2005-04-06
  • 打赏
  • 举报
回复
up
YJBOLD 2005-04-06
  • 打赏
  • 举报
回复
欢迎继续讨论!
YJBOLD 2005-04-06
  • 打赏
  • 举报
回复
to liuxiaoyi666(兔子)
有点明白了,那实际上完全可以不用SET 因为我只要把那个rs public就行了.
对吧?
Tomato77 2005-04-06
  • 打赏
  • 举报
回复
http://blog.csdn.net/zhcool/archive/2004/10/17/140370.aspx
lawyu 2005-04-06
  • 打赏
  • 举报
回复
:)
underone 2005-04-06
  • 打赏
  • 举报
回复
学习
UP
  • 打赏
  • 举报
回复
Class calendar
Dim calendarmonth, calendaryear, calendarday
Dim today
Dim table1
Dim todayw
set rs=server.createobject("adodb.recordset")
Private Sub Class_Initialize
today = Date
Set table1 = document.getElementById("calendartable")
End Sub

Function tableclear()
rowsnum = 1
j = 0
For i = 0 To 41
table1.rows(rowsnum).cells(j).innerText = ""
j = j + 1
If j = 7 Then
j = 0
rowsnum = rowsnum + 1
End If
Next
End Function

Public Property Get thedayd()
If Len(calendarday) = 0 Then
calendarday = Day(today)
End If
theyeard = calendaryear
End Property

public property set thedate(sql)
rs.open sql1,conn,1,3
thedate=rs
end property

Public Property Let thedayd(theday)
calendarday = theday
End Property

Public Property Get theyeard()
If Len(calendaryear) = 0 Then
calendaryear = Year(today)
End If
theyeard = calendaryear
End Property

Public Property Get themonthd()
If Len(calendarmonth) = 0 Then
calendarmonth = Month(today)
End If
themonthd = calendarmonth
End Property

Public Property Let theyeard(theyear)
calendaryear = theyear
End Property

Public Property Let themonthd(themonth)
calendarmonth = themonth
End Property

Function displayDay()
Dim days, theday
Dim d
Dim rows
Dim cells
rows = 1
d = calendaryear&"-"&calendarmonth&"-"&"1"
todayw = Weekday(d)
Select Case calendarmonth
Case 1
days = 31
Case 2
days = runnian(calendaryear)
Case 3
days = 31
Case 4
days = 30
Case 5
days = 31
Case 6
days = 30
Case 7
days = 31
Case 8
days = 31
Case 9
days = 30
Case 10
days = 31
Case 11
days = 30
Case 12
days = 31
End Select
rowsnum = 1
j = todayw -1
For i = 1 To days
table1.rows(rowsnum).cells(j).innerText = i
j = j + 1
If j = 7 Then
j = 0
rowsnum = rowsnum + 1
End If
Next
End Function


Function runnian(theyear)
If theyear Mod 100 = 0 Then
If theyear Mod 4 = 0 Then
runnian = 29
Else
runnian = 28
End If
Else
If theyear Mod 4 = 0 Then
runnian = 29
Else
runnian = 28
End If
End If
End Function


Function addrecord(rowsnum, cellsnum, showday)
showday = Replace(showday, "\", "/")
showday = "file:///"&showday
table1.rows(rowsnum -1).cells(cellsnum).innerHTML = "<a href='"&showday&"'>"&table1.rows(rowsnum -1).cells(cellsnum).innerHTML&"</a>"
End Function

End Class
实际上我如上程序本来是没有set的,只不过为了配合说明set和let的不同之处写的

调用的时候用set ttt=new class ttt.thedata-----这个就相当于一个rs对象了
TSD 2005-04-06
  • 打赏
  • 举报
回复
TO:tigerhu76(虎虎)

这些都是类里针对对象属性操作的一些方法,不是有没有什么好处的.

就拿生活中的一些东西来说吧,像杯子,手机这些都是一个对象,那么这个对象肯定就有它本身的属性,如一个杯子,它是圆的,可以装水,这些就是它的属性.

如在程序中定义一个个人的信息,像姓名、年龄这都是属性,要给这个姓名属性赋值就得用let,取这个姓名这个属性就得用get

YJBOLD 2005-04-06
  • 打赏
  • 举报
回复
up
libaisongtuye 2005-04-06
  • 打赏
  • 举报
回复
学习
YJBOLD 2005-04-06
  • 打赏
  • 举报
回复
谁能举个 property set 的例子,这样好理解,
yjbnew 2005-04-06
  • 打赏
  • 举报
回复
UP
tigerhu76 2005-04-06
  • 打赏
  • 举报
回复
我也没弄懂 get,set,let 三个有什么用处和好处,发觉只用 sub 或 function 就可以了
加载更多回复(12)

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧