---
title: Class
description: Classes with their members, and the relations between them.
source: https://github.com/crabtalk/bezel/blob/main/crates/mermaid/src/diagrams/class/mod.rs
---

> One page of the bezel documentation. The index is https://bezel.gallery/llms.txt

# Class

```mermaid
classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
        +String beakColor
        +swim()
        +quack()
    }
    class Fish{
        -int sizeInFeet
        -canEat()
    }
    class Zebra{
        +bool is_wild
        +run()
    }
```

## Syntax

- `class Name { … }` lists members; `+`, `-`, `#` and `~` set visibility, and `()` makes a method.
- `Name : +member` adds one member outside the block.
- `<|--` is inheritance, `*--` composition, `o--` aggregation, `-->` association, `..>` dependency, `..|>` realization.
- `: text` after a relation labels it; quoted cardinalities sit at either end.
- `namespace Name { … }` groups classes; `note` and `note for Name` add notes.
