mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Merge pull request #3035 from SlideeScherz/patch-1
Fixed whitespace typo in Class diagram
This commit is contained in:
commit
6d2c6c13a7
@ -8,28 +8,27 @@ The class diagram is the main building block of object-oriented modeling. It is
|
|||||||
Mermaid can render class diagrams.
|
Mermaid can render class diagrams.
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
classDiagram
|
classDiagram
|
||||||
Animal <|-- Duck
|
Animal <|-- Duck
|
||||||
Animal <|-- Fish
|
Animal <|-- Fish
|
||||||
Animal <|-- Zebra
|
Animal <|-- Zebra
|
||||||
Animal : +int age
|
Animal : +int age
|
||||||
Animal : +String gender
|
Animal : +String gender
|
||||||
Animal: +isMammal()
|
Animal: +isMammal()
|
||||||
Animal: +mate()
|
Animal: +mate()
|
||||||
class Duck{
|
class Duck{
|
||||||
+String beakColor
|
+String beakColor
|
||||||
+swim()
|
+swim()
|
||||||
+quack()
|
+quack()
|
||||||
}
|
}
|
||||||
class Fish{
|
class Fish{
|
||||||
-int sizeInFeet
|
-int sizeInFeet
|
||||||
-canEat()
|
-canEat()
|
||||||
}
|
}
|
||||||
class Zebra{
|
class Zebra{
|
||||||
+bool is_wild
|
+bool is_wild
|
||||||
+run()
|
+run()
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
@ -79,12 +78,12 @@ There are two ways to define the members of a class, and regardless of whichever
|
|||||||
- Associate a member of a class using **:** (colon) followed by member name, useful to define one member at a time. For example:
|
- Associate a member of a class using **:** (colon) followed by member name, useful to define one member at a time. For example:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
classDiagram
|
classDiagram
|
||||||
class BankAccount
|
class BankAccount
|
||||||
BankAccount : +String owner
|
BankAccount : +String owner
|
||||||
BankAccount : +BigDecimal balance
|
BankAccount : +BigDecimal balance
|
||||||
BankAccount : +deposit(amount)
|
BankAccount : +deposit(amount)
|
||||||
BankAccount : +withdrawal(amount)
|
BankAccount : +withdrawal(amount)
|
||||||
```
|
```
|
||||||
|
|
||||||
- Associate members of a class using **{}** brackets, where members are grouped within curly brackets. Suitable for defining multiple members at once. For example:
|
- Associate members of a class using **{}** brackets, where members are grouped within curly brackets. Suitable for defining multiple members at once. For example:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user