First, the implementation of the interface
1. Create an ActiveX DLL Project, name ICOM
2, add a class (interface), named IDog, set the properties and methods:
Public property get name () AS STRING
End Property
Public property let name (byval vnewvalue as string)
End Property
Public Sub Bark ()
End Sub
Public Sub Rollover (byref rolls as integer)
End Sub
3, add another class (implementation of the interface), named cbeagle, the implementation of IDog is as follows:
Implements idog
Private mname as string
Private sub idog_bark ()
End Sub
Private property let idog_name (byval rhs as string) MNAME = rhsend property
Private property get idog_name () as string idog_name = mnameEnd Property
Private sub idog_rollover (rolls as integer) rolls = rolls 12nd SUB
Second, by interface IDog to cbeagle's reference
1. New standard projects, reference to ICOM
2, add a FORM1, draw a button command1, implement the code as follows:
Private submmand1_click ()
DIM I as INTEGER I = 12
'method one
'DIM MDOG As ICOM.idog'SET MDOG = CREATEOBJECT ("iCom.cbeagle")
'Method Two
Dim MDOG As IDogset MDog = New Cbeagle
Mdog.rollover I MSGBOX I
End Sub