Members are prefixed with a visibility marker: + public, - private.
classDiagram
class Animal {
+String name
+int age
+isMammal() bool
}Six relations, each with its own arrowhead. The left two are UML classics.
classDiagram
Animal <|-- Duck
Car *-- Wheel
Team o-- Member
User --> Order
Order ..> InvoiceA colon after the relation is the verb between the two types.
classDiagram
Keeper "1" --> "*" Animal : feeds
Animal "1" --> "0..*" Leg : hasQuoted numbers before each end say how many of that type are involved.
classDiagram
Customer "1" --> "*" Order : places
Order "1" *-- "1..*" LineItem : containsAngle brackets inside the class body label its kind.
classDiagram
class Shape {
<<interface>>
+draw() void
}
Circle ..|> ShapeSame keyword as flowcharts. Default is top to bottom.
classDiagram
direction LR
Animal <|-- Duck
Animal <|-- Fish