This seems to work fine:
Question is that i have a single variable of a specific interface type where i want to refer to the class created.
Like:
So that i get's independent from the actual type.
In practice i would like to do this:
The above fails but is my logic flawed?
If not should store the interface in an IUnknown type?
IUnknown is afaik not mentioned in the help to be a variable type.
Code:
Class Class1 Interface Class1_Interface1: Inherit IUnknown Method TEST() As String Method = "1234" End Method End Interface End Class Class Class2 Interface Class2_Interface1: Inherit Class1, Class1_Interface1 Override Method TEST() As String Method = "2345" End Method End Interface End Class Function Test() As Long Local i1 As Class1_Interface1 Local i2 As Class2_Interface1 i1 = Class "Class1" i2 = Class "Class2" MsgBox i1.TEST() & ", " & i2.TEST() End Function
Like:
Code:
Function Test() As Long Local i2 As Class2_Interface1 Local i As Class1_Interface1 i2 = Class "Class2" i = i2 MsgBox i.TEST() End Function
In practice i would like to do this:
Code:
Function Test() As Long Local i As Class1_Interface1 i = Class "Class2" MsgBox i.TEST() End Function
If not should store the interface in an IUnknown type?
IUnknown is afaik not mentioned in the help to be a variable type.
Comment