You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
782 B
21 lines
782 B
+---------------------------+
|
|
| Shape | <-- 抽象类
|
|
+---------------------------+
|
|
| |
|
|
| + getArea(): double | <-- 抽象方法
|
|
+---------------------------+
|
|
▲
|
|
| 继承
|
|
+----------+----------+-----------+
|
|
| Circle | Rectangle | Triangle |
|
|
+-----------+----------+-----------+
|
|
| - radius: double | - width: double | - base: double |
|
|
| + Circle(r: double) | + Rectangle(w: double, h: double) | + Triangle(b: double, h: double) |
|
|
| + getArea(): double | + getArea(): double | + getArea(): double |
|
|
+-----------+----------+-----------+
|
|
|
|
+---------------------------+
|
|
| ShapeUtil | <-- 工具类
|
|
+---------------------------+
|
|
| + printArea(s: Shape): void|
|
|
+---------------------------+
|