Is it possible to use a generalized event which transports different parameter types?
I have a parent class, which defines such an event, but the sub classes implement the event creation in different ways.
' on class AbstractLoader Event finish(obj as Variant)Now I try to raise such an event on different parts of the code
' on class LoaderA inherits AbstractLoader Raise finish(new MyTestA())or
' on class LoaderB inherits AbstractLoader Raise finish(new MyTestB())The classes MyTestA and MyTestB don't have the same parent class, so I create complete different objects within the subclasses.
The classes which collect the events, should check the type of the transported object, but must convert them into the right type:
Dim loader as LoaderA loader = new LoaderA as "myloader" public sub myloader_finish(obj as Variant) ' here I have to convert the "obj" into "MyTestA" again, to use the ' right type later endWith other programming languages I would use explicit type conversion like
Dim my as MyTestA my = (MyTestA) objBut this seems not possible in Gambas3. How I could do that?