# 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.

- PDF: https://legivel.com/examples/mermaid-diagrams/class-diagram.pdf
- Page: https://legivel.com/examples/mermaid-diagrams/class-diagram
- Open in the editor: https://legivel.com/markdown-to-pdf?sample=mermaid-class
- More mermaid diagrams in Markdown to PDF: https://legivel.com/examples/mermaid-diagrams

## Markdown source

````markdown
# 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.
````
