Sorry, but maybe I haven't yet switched from VB to B4A mode to understand your solution. Or I didn't properly explain my requirement.
But I think this will be an important topic to many VB developers who, like myself, really appreciate your product - so..
Let's say I have 2 different classes, each with a DIFFERENT implementation (eg calculation to be performed) within Notify:
Class1:
Sub Notify(newline as string)
' do something with newline
End sub
Class2:
Sub Notify(newline as string)
' do something DIFFERENT with newline
End sub
To implement this in VB, for example, I do the following:
1. Create an Interface class, called say IListener with 1 sub:
Sub Notify(newline as string)
End Sub
2. Create a collection class called say ListenerCollection with:
private myListeners() as IListener
...
Implements IListener
...
Sub IListener_Notify(newline as string)
For i=0 to myListeners.UpperBound
myListeners(i).Notify(newline)
next i
End Sub
3. Create the classes (Class1 and Class2), each with a different implementation of Notify:
...
Implements IListener
...
Sub IListener_Notify(newline as string)
' do something different with newline
End Sub
4. Now, in my application, I can do the following:
Dim Listeners as new ListenerCollection
Dim L1 as new Class1
Dim L2 as new Class2
Listeners.Add(L1)
Listeners.Add(L2)
Dim rdr as new CSVReader
rdr.Listeners=Listeners
...and in my CSVReader:
Do Until EOF
'read line
linestring=myrdr.ReadLine
'notify ALL listeners
Listeners.Notify(linestring)
Loop
As mentioned, I can see how to replicate the CSVReader and notify a collection of listeners - but not how to replicate the different class1 and class2 implementations to support myListeners(i).Notify(newline) as above.
Many thanks