我有一个接口,比如说
Interface ICallback {
public void informFunction();
}
我有一个类,比如说:
Class Implementation implements ICallback {
public Implementation() {
new AnotherImplementation(this);
}
@override
public void informFunction() {
// do something
}
}
现在考虑一个类,其中Class Implementation的实例被传递为接口,并用于进行回调。
Class AnotherImplementation {
public ICallback mCallback;
public AnotherImplementation(ICallback callback) {
mCallback = callback;
}
public void testFunction() {
mCallback.informFunction(); // Callback
}
}
现在我想知道如何设计UML类图。最重要的是我需要知道如何表示将发生在类AnotherImplementation :: testFunction()中的回调功能。