Class Diagram Arrows Explained: What Every Line and Symbol Means
Table of Contents
You have a UML class diagram in front of you and you are not sure what the arrows mean. Is that a filled diamond or a hollow one? Does the triangle point at the parent or the child? This happens to everyone the first ten times.
This guide is a plain-English reference for every arrow and symbol you will encounter in a UML class diagram, with the Mermaid syntax for drawing each one.
The Six Arrow Types at a Glance
| Arrow | Name | Mermaid | Meaning in plain English |
|---|---|---|---|
| Solid line + hollow triangle | Inheritance | <|-- | "Dog is a kind of Animal" |
| Solid line + filled diamond | Composition | *-- | "Room only exists inside House" |
| Solid line + hollow diamond | Aggregation | o-- | "Player exists even after Team dissolves" |
| Solid line + open arrowhead | Association | --> | "Customer places an Order" |
| Dashed line + open arrowhead | Dependency | ..> | "Method temporarily uses another class" |
| Dashed line + hollow triangle | Realization | ..|> | "Class implements an interface" |
The two things that change the meaning are: (1) solid vs dashed line, and (2) what is on the ends. Master those combinations and you can read any class diagram.
Solid Lines vs Dashed Lines
Solid lines represent structural relationships — the classes are connected in the object model at runtime. One object holds a reference to the other, or inherits from it.
Dashed lines represent weaker, often transient relationships — one class depends on another but does not necessarily hold a persistent reference. In practice this usually means a method call, a parameter type, or an interface contract.
Memory trick: solid = stays, dashed = temporary.
Diamond Symbols: Filled vs Hollow
The diamond always sits at the container end of the relationship — the class that "has" the other.
Filled diamond (composition): The child cannot live without the parent. Destroying the container destroys its contents. Example: a Blog Post has Comments — delete the post and the comments go too. Mermaid: Post *-- Comment.
Hollow (open) diamond (aggregation): The child has its own lifecycle. The container holds a reference, but the child can exist independently. Example: a Playlist has Songs — delete the playlist and the songs still exist in the library. Mermaid: Playlist o-- Song.
If you can only remember one rule: filled diamond = child dies with parent. Hollow diamond = child survives.
Sell Custom Apparel — We Handle Printing & Free ShippingTriangle Symbols and Which Way They Point
Triangles always point toward the more general (parent) class — whether on a solid line (inheritance) or a dashed line (realization/interface).
Solid line + hollow triangle = inheritance. The triangle points at the parent class. In Mermaid, Animal <|-- Dog — the triangle is at Animal because Animal is the parent. Dog inherits from Animal.
Dashed line + hollow triangle = realization. The triangle points at the interface. In Mermaid, Flyable ..|> Bird — the triangle is at Flyable because Flyable is the interface. Bird implements Flyable.
Memory trick: the triangle always points up the hierarchy.
Cardinality Labels on Class Diagram Lines
Lines can have numbers or symbols at each end to show how many objects participate in the relationship. This is called cardinality or multiplicity.
- 1 — exactly one
- 0..1 — zero or one (optional)
- 1..* — one or more
- 0..* or * — zero or more
- n — a specific number
In Mermaid class diagrams you add these as quoted strings on each side of the relationship:
Customer "1" --> "0..*" Order
This reads: one Customer can have zero or more Orders. Cardinality makes a diagram much more precise — always add it when the quantity matters for design decisions.
Try Drawing These Arrows in the Free Online Tool
Open the Badger Class Diagram tool and paste this example to see all six relationship types at once:
classDiagram class Vehicle class Car class Engine class Wheel class Driver class Driveable Vehicle <|-- Car Car *-- Engine Car o-- Wheel Driver --> Car Driver ..> GPS Car ..|> Driveable
The live preview renders each relationship with its correct arrow. When it looks right, click Export PNG or Export SVG — no signup needed.
Try It Free — No Signup Required
Runs 100% in your browser. No data is collected, stored, or sent anywhere.
Open Free Class Diagram ToolFrequently Asked Questions
What is the difference between the filled and hollow diamond in a class diagram?
The filled diamond represents composition — the child object cannot exist without the parent. The hollow diamond represents aggregation — the child has its own independent lifecycle and can exist after the parent is gone.
Which way does the inheritance arrow point in UML?
The triangle (hollow arrowhead) in an inheritance arrow always points toward the parent class. In Mermaid: Animal <|-- Dog means Dog inherits from Animal. The triangle points at Animal.
What does a dashed line mean in a class diagram?
A dashed line represents a weaker, often transient relationship. A dashed line with an open arrowhead is a dependency (one class uses another temporarily). A dashed line with a hollow triangle is realization (a class implements an interface).
How do I add multiplicity labels like 1..* in Mermaid?
Add quoted strings on each side of the relationship: Customer "1" --> "0..*" Order. This means one Customer has zero or more Orders.

