简体   繁体   中英

How do I represent subclass invocations in Activity Diagrams

  1. Class 1 creates Class 2 which is a subclass of class 3
  2. Class 1 invokes a method on Class 2, which doesn't implement that method and instead hands it off to class 3
  3. Class 3 then calls a method on Class 2

If I represent all 3 classes on the diagram, and then draw an arrow between class 1 and 3, it looks like 1 is directly invoking 3, which it isn't. However, I also don't want to make it look like Class 2 is implementing that method.

You have a fundamental error in your thought. SDs and ADs do not show classes, but instances. And there are only two instances here, namely that of Class1 and that of Class2 being a subclass of Class3 . So the internal call from Class2 's instance goes to itself.

The structure is like this:

在此处输入图片说明

And the SD like that:

在此处输入图片说明

In an AD it would look like this:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM