Mermaid class diagram in Markdown to PDF
Classes show their typed members, the relation kinds keep their arrowheads, and multiplicities sit on the edges.
Inheritance, interfaces, composition and aggregation, multiplicities on the edges and typed members, for a library lending system.
Markdown source
Markdown · 51 lines# Class diagrams
```mermaid
classDiagram
class Item {
<<abstract>>
+string barcode
+string title
+int year
+isAvailable() bool
}
class Book {
+string isbn
+string[] authors
+int pages
}
class Film {
+int minutes
+string rating
}
class Patron {
+string cardNumber
+string name
+Date memberSince
+borrow(Item) Loan
}
class Loan {
+Date issued
+Date due
+Date returned
+fine() Money
}
class Branch {
+string name
+string city
+openingHours() string
}
class Reservable {
<<interface>>
+reserve(Patron) Reservation
}
Item <|-- Book
Item <|-- Film
Reservable <|.. Item
Patron "1" --> "0..*" Loan : holds
Loan "0..*" --> "1" Item : for
Branch "1" *-- "0..*" Item : shelves
Branch "1" o-- "0..*" Patron : registers
```
Inheritance `<|--`, realization of an interface `<|..`, composition `*--`, aggregation `o--` and association `-->`, each with a label and multiplicities at both ends.
Rendered pages
PDF · 2 pages · 13 KBThe sample documents describe invented organizations in several countries. All names and figures are illustrative.
Mermaid diagrams in Markdown to PDF: every sampleIn the Markdown reference

