开发者

UML abstraction

开发者 https://www.devze.com 2023-02-20 17:05 出处:网络
I have one abstract class1 which has abstract method1(). Class2 implements class2 and overrides method1().

I have one abstract class1 which has abstract method1(). Class2 implements class2 and overrides method1(). Class3 extends class2 and overrides metho开发者_如何学Cd1().

Which of the two solutions in the image is the correct one according to UML?

UML abstraction


Neither is correct - although solution 1 is even less correct than solution 2. First, there are some syntactic things you need to sort:

  1. Your diagram shows the relations among classes as Binary Associations. They're not - they're subtype relations. Those have a different graphical syntax.
  2. Abstract items (classes/methods) should be shown in italics.

There are also 2 semantic things you need to sort; some hints:

  1. A class can't implement another class. A class can implement an interface or extend (subtype) another class.
  2. You need to draw the relationships between the classes correctly. Big hint: this is where solution 2 is more correct than solution 1. You need to figure out why.

hth.

0

精彩评论

暂无评论...
验证码 换一张
取 消