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