Take a look at the followingCode:
' Interface command
Public Sub Execute (): End sub
' Testcommand
Implements vb6dpframework. Command
Public Count As Integer
Private Sub Command_execute ()
Count = 1
End sub
' Commandwrapper
Private Mself As Testcommand
Private Minterface As Vb6dpframework. Command
Public Sub Dispose ()
Set Mself = Nothing
Set Minterface = Nothing
End sub
Public Sub Instance ()
If Minterface Is Nothing Then
Set Minterface = New Testcommand
Set Mself = Minterface
End If
End sub
Public Function Interface () As Vb6dpframework. Command
Instance
Set Interface = Minterface
End Function
Public Function Self () As Testcommand
Instance
Set Self = Mself
End Function
' Testcase
Public Sub Test_wrapper (otestresult As Testresult)
With Otestresult
Dim W As New Commandwrapper
W. interface. Execute
. Assertequalslong W. Self. Count, 1
Set W = Nothing
End With
End sub
Testcommand inherits the command interface.
The dim t as command method cannot access the Count attribute.
If
The dim t as testcommand method cannot access the execute method.
This makes it difficult to use. Of course, if you implement a public execute in testcommand, you can declare multiple objects and assign values, to solve this problem, using commandwrapper may be a good choice, at least better.