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.
47 lines
796 B
47 lines
796 B
@startuml
|
|
' 设置样式
|
|
skinparam classAttributeIconSize 0
|
|
skinparam backgroundColor #FEFEFE
|
|
skinparam class {
|
|
BackgroundColor #E1F5FE
|
|
BorderColor #0288D1
|
|
ArrowColor #0288D1
|
|
}
|
|
|
|
abstract class Shape {
|
|
{abstract} + getArea(): double
|
|
}
|
|
|
|
class Circle {
|
|
- radius: double
|
|
+ Circle(radius: double)
|
|
+ getArea(): double
|
|
}
|
|
|
|
class Rectangle {
|
|
- width: double
|
|
- height: double
|
|
+ Rectangle(width: double, height: double)
|
|
+ getArea(): double
|
|
}
|
|
|
|
class Triangle {
|
|
- base: double
|
|
- height: double
|
|
+ Triangle(base: double, height: double)
|
|
+ getArea(): double
|
|
}
|
|
|
|
class ShapeUtil {
|
|
+ {static} printArea(shape: Shape): void
|
|
}
|
|
|
|
' 继承关系
|
|
Shape <|-- Circle
|
|
Shape <|-- Rectangle
|
|
Shape <|-- Triangle
|
|
|
|
' 依赖关系
|
|
ShapeUtil ..> Shape : uses
|
|
|
|
@enduml
|