Library system class diagram
Member, book, loan and librarian classes. A loan associates a member with a book; members and librarians inherit from person.
The diagram
Reading it step by step
- 'Person' (class): 1 attributes, 0 methods.
- 'Member' (class): 1 attributes, 1 methods.
- 'Librarian' (class): 1 attributes, 1 methods.
- 'Book' (class): 2 attributes, 0 methods.
- 'Loan' (class): 1 attributes, 1 methods.
- 'Member' inherits from 'Person'.
- 'Librarian' inherits from 'Person'.
- 'Loan' is associated with 'Member'.
- 'Loan' is associated with 'Book'.
Shape by shape
| Shape | Symbol | Connections |
|---|---|---|
| Person | Class | holds +name String · ← Member, Librarian |
| Member | Class | holds +memberNo int, +borrow(book) Loan · → Person · ← Loan |
| Librarian | Class | holds +staffNo int, +addBook(book) void · → Person |
| Book | Class | holds +isbn String, +title String · ← Loan |
| Loan | Class | holds +loanedOn Date, +giveBack() void · → Member, Book |
Symbols used here
| Symbol | Meaning |
|---|---|
| Class | A box with name, attributes and methods. |
| Inheritance | Solid line from child to parent, hollow triangle at the parent. |
| Association | One class knows and uses another; solid arrow. |
Diagram text
Paste this text into the editor to get the same picture, then change the names to fit your own work.
# Library system class diagram
classDiagram
class Person {
+name String
}
class Member {
+memberNo int
+borrow(book) Loan
}
class Librarian {
+staffNo int
+addBook(book) void
}
class Book {
+isbn String
+title String
}
class Loan {
+loanedOn Date
+giveBack() void
}
Person <|-- Member
Person <|-- Librarian
Loan --> Member
Loan --> Book