??????????VB???????????????Class?????????“???”????????????????????????е?????????????????????????? (attribute) ???????

???????Class?????????????????????ж????????? (attribute) ?????????? (property) ?????????????????

??????????????????????????????????????????????????????????

???????????????????????????У?????????е????????????????????????????????????????????????????????

???????????????Class?????????OO?????????????????????????????QTP?????????????????????????μ??????????н??????

??????????????QTP?????Class????????????д???????QTP?????Class?????????????????????QTP??Expert View???????Ч???????

Call Test

Class Tester

        Dim mvarTesterName??mvarAge??mvarGender       
       
        Sub Class_Initialize   '??????
               MsgBox  "?????????????????μ??????"
        End Sub
       
        Sub Class_Terminate  '????????
                If mvarGender Then
                    MsgBox "???????" & mvarTesterName & "??????????????????"
                Else
                    MsgBox "???????" & mvarTesterName & "????????????????"
                End If
        End Sub

        Sub Test(ByVal ProjectName)
                MsgBox mvarTesterName & "????????????" & ProjectName & "??!"
        End Sub
       
        Sub Eat(ByVal food)
                MsgBox mvarTesterName & "?????" & food & "??????????"
        End Sub
       
        Property Let Gender(ByVal vData)
            mvarGender = vData           
        End Property
       
        Property Get Gender()
            Gender = mvarGender
        End Property
       
        Property Let Age(ByVal vData)
            mvarAge = vData
        End Property
       
        Property Get Age()
            Age = mvarAge
        End Property
       
        Property Let TesterName(ByVal vData)
            mvarTesterName = vData
        End Property
       
        Property Get TesterName()
            TesterName = mvarTesterName
        End Property
  
End Class

Sub Test()
        Set sb = New Tester  '???????????????????somebody????????Tester??????????
        sb.TesterName = "songfun"
        sb.Age = 29
        sb.Gender = True
        sb.Eat "HagenDaz"
        sb.Test "???"
        If sb.Gender Then
                MsgBox sb.TesterName & "??????" & sb.Age
   Else
                MsgBox sb.TesterName & "??????" & sb.Age
        End If
        Set sb = Nothing
End Sub