tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,924
- Office Version
- 365
- 2019
- Platform
- Windows
This video shows how to use Class Interfaces:
https://www.youtube.com/watch?v=3bO50gHRndA
The restriction I find with Interfaces is every class that implements the Interface class must adhere to its rules.
Instead, why not do this?
Class1:
and Class2:
https://www.youtube.com/watch?v=3bO50gHRndA
The restriction I find with Interfaces is every class that implements the Interface class must adhere to its rules.
Instead, why not do this?
Code:
Sub Test()
Dim obj As Object
Dim i As Long
For i = 1 To 2
If i = 1 Then
Set obj = New Class1
Else
Set obj = New Class2
End If
Call obj.PrintMsg
Next i
End Sub
Class1:
Code:
Sub PrintMsg()
Debug.Print 1
End Sub
and Class2:
Code:
Sub PrintMsg()
Debug.Print 2
End Sub