Diagram Desk

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

Person+name StringMember+memberNo int+borrow(book) LoanLibrarian+staffNo int+addBook(book) voidBook+isbn String+title StringLoan+loanedOn Date+giveBack() void
Class diagram · 14 shapes

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

ShapeSymbolConnections
PersonClassholds +name String · ← Member, Librarian
MemberClassholds +memberNo int, +borrow(book) Loan · → Person · ← Loan
LibrarianClassholds +staffNo int, +addBook(book) void · → Person
BookClassholds +isbn String, +title String · ← Loan
LoanClassholds +loanedOn Date, +giveBack() void · → Member, Book

Symbols used here

SymbolMeaning
ClassA box with name, attributes and methods.
InheritanceSolid line from child to parent, hollow triangle at the parent.
AssociationOne class knows and uses another; solid arrow.

All class diagram symbols and how to draw

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

More class diagram examples

All SeewolLabs tools