How to represent Callback in UML Class Diagram

Viewed 18873

I have an Interface say

Interface ICallback {
    public void informFunction();
}

I have a Class say:

Class Implementation implements ICallback {

   public Implementation() {
      new AnotherImplementation(this);
   }

   @override
   public void informFunction() {
      // do something
   }

}

Now consider a class where in the instance of Class Implementation is passed as a interface and is used to make a callback.

Class AnotherImplementation {
   public ICallback mCallback;

   public AnotherImplementation(ICallback callback) {
      mCallback = callback;
   }

   public void testFunction() {
     mCallback.informFunction();  // Callback
   }
}

Now I want to know how I can design a UML Class Diagram. Most importantly I need to know how to represent Callback Functionality that will happen in the Class AnotherImplementation :: testFunction().

1 Answers
Related