void AboutToBlow(string msg);
void Exploded(string msg);
}
Callback interfaces are often not implemented by the object directly interested in receiving the
events, but rather by a helper object called a
sink object. The sender of the events (the Car type in
this case) will make calls on the sink under the appropriate circumstances. Assume the sink class is
called CarEventSink. When this object is notified of the various incoming events, it will simply print
out the incoming messages to the console. Furthermore, our sink will also maintain a string mem-
ber variable that represents its friendly name (you’ll see how this can be useful as you move through
the example):
Do'stlaringiz bilan baham: