Lets say I have a class A
which is going to be compiled into a dll
to be used later. But I kind of know that later, some methods of class B
which I am not aware of its type must be called in A
class. The only clue is the name of the methods.
Lets say this is class A
:
public class A
{
A(Object instanceOfClassB)
{
//stuff...
}
public void SendProcessedString()
{
//some strings has been processd, I know that class B is going
//to have a public method like ReceiveData(string data){/*---*/}
instanceOfClassB.ReceiveData(data);
}
}
Lets say this is class B
, happen to be a WinForm:
public B : Form
{
public void ReceiveData(string data)
{
textBox.Append(data + Environment.NewLine);
}
}
Is such approach possible/recommended?