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?
Neither is correct - although solution 1 is even less correct than solution 2. First, there are some syntactic things you need to sort:
- Your diagram shows the relations among classes as Binary Associations. They're not - they're subtype relations. Those have a different graphical syntax.
- Abstract items (classes/methods) should be shown in italics.
There are also 2 semantic things you need to sort; some hints:
- A class can't implement another class. A class can implement an interface or extend (subtype) another class.
- 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.
精彩评论