`
tengzejun508
  • 浏览: 26015 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

vbs class的调用及字典的应用代码

    博客分类:
  • QTP
阅读更多

<!--StartFragment -->
Class clsTest1
Public oDict
Private Sub class_initialize()
Set oDict = CreateObject("Scripting.Dictionary")
End Sub

Public Function setting
oDict.Add "a",""
oDict.Add "b",""
oDict.Add "c",""
oDict.Add "d",""
End Function

Public Function test1()
oDict("a") = "aaaa"
oDict("b") = "bbbb"
End Function

Public Function test2()
oDict("c") = "cccc"
oDict("d") = "dddd"
End Function

Public Function ShowODict(name)
     Call test1()
     Call test2()
ShowODict = oDict.Item(name)
End Function
End Class

Class clsTest2
Dim aaa
Private Sub class_initialize
Set aaa = New clsTest1
End Sub


Public Function getValue()
msgbox aaa.ShowODict("c")
End Function
End Class

Set aa=new clsTest2
aa.getValue()
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics