← All examples

class-core

classDiagram
class Animal {
  +int age
  +String gender
  #bool warmBlooded
  ~String tag
  +isMammal() bool
  +mate(Animal partner) Animal
}
class Duck {
  -String beakColor
  +swim()
  +quack() String
}
class Fish {
  -int sizeInFeet
  #canEat() bool
}
class Zebra {
  +bool isWild
  +run()*
}
class Flyer {
  +fly() bool
}
class Registry {
  -int cachedCount$
  +lookup(String name) Animal$
}

Feather : +String color
Feather : +float lengthInCm

Animal <|-- Duck
Animal <|-- Fish
Animal <|-- Zebra
Duck ..|> Flyer : implements
Habitat *-- Animal : houses
Duck o-- Feather : plumage
Keeper "1" --> "*" Animal : cares for
Keeper -- Habitat
Registry ..> Animal : looks up
Zebra .. Habitat