VBScript 中 Property Let 与 Property Set 区别

作者:vkvi 来源:ITPOW(原创) 日期:2009-10-5

Property Let 是对类模块里的属性(基本数据类型)写赋值过程用的。

Property Set 是对类模块里的属性(对象)写赋值过程用的。

相当于为属性赋值有两种写法:Let 和 Set;但从属性取值就只有一种写法:都是 get。

Set 用法

'类
Class Class1
    Public Property Set RS(Value)
        Set Rs = Value
    End Property
End Class
 
'调用
set c1 = new Class1
set rs = Server.CreateObject("ADODB.Recordset")
set c1.Rs = rs

相关阅读

相关文章