For members experienced with objects the following is probably 'old hat' but I couldn't find anything in the documentation mentioning its use.
It is a simple way to have a single statement do more than one task depending upon the assigned Class.
The 'trick' is to duplicate both an Interface name and a method name.
The following snippet illustrates the concept.
It is a simple way to have a single statement do more than one task depending upon the assigned Class.
The 'trick' is to duplicate both an Interface name and a method name.
The following snippet illustrates the concept.
Code:
#Compile Exe #Dim All Macro CreateObj(ObjectName, ClassName) = ObjectName = Class ClassName Macro DestroyObj(ObjectName) = ObjectName=Nothing Class CShortDisplay Interface IDisplay: Inherit IUnknown Method Table() As Long ? "ShortDisplay" End Method End Interface End Class Class CFullDisplay Interface IDisplay: Inherit IUnknown Method Table() As Long ? "FullDisplay" End Method End Interface End Class Global ShowMy As IDisplay Function PBMain( ) As Long CreateObj(ShowMy, "CShortDisplay") ShowMy.Table DestroyObj(ShowMy) CreateObj(ShowMy, "CFullDisplay") ShowMy.Table DestroyObj(ShowMy) ' Waitkey$ End Function