i want to achieve an C# like Event Handling in Standard C++ (UNIX) like the following Code:
public class connection{
public delegate void Message(object sender, string text);
public event Message doMessage = null;
//called from within a Thread or something alike
private void MessageReceived(string Message){
if (this.doMessage != null)
{
this.doMessage(this, Message);
}
}
}
public class Main{
Connection con;
public Main()
{
this.con = new Connection();
this.con.doMessage += con_doMessage;
}
void con_doMessage(object sender, string message)
{
txtMain.Text = txtMain.Text + Environment.NewLine + message;
}
}
I googled my fingertips bloody but all i found was Events firing, but not to an overlaying class like in my Example.
In fact, i'm new to Standard C++, maybe there is an easy way to get Data to the overlaying class, by firing it from within the class and i just didn't see it yet.
But yeah, as said, i have no clue and would be thankfull for some advice.