vba implements interface code example
Example: vba implements interface
' Add class ClsInterface:
Public Function add(x As Integer, y As Integer) As Integer
End Function
'-----------------------------------------------------------------------
' Add class ClsMyClass: add(...) is Private
Implements ClsInterface
Private Function ClsInterface_add(x As Integer, y As Integer) As Integer
ClsInterface_add = x + y
End Function
'-----------------------------------------------------------------------
Sub TestMe()
Dim obj As New ClsInterface
Debug.Print obj.add(1,2) '3
End Sub