Diagram Desk

Bank account class diagram

Savings and deposit accounts inherit from account; a customer holds accounts. The balance is private (-) and changes only through methods: encapsulation.

The diagram

Customer+customerNo intAccount-balance long+deposit(amount) void+withdraw(amount) boolSavingsAccount+transfer(to, amount) boolFixedDeposit+maturity Dateholds
Class diagram · 10 shapes

Reading it step by step

  • 'Customer' (class): 1 attributes, 0 methods.
  • 'Account' (class): 1 attributes, 2 methods.
  • 'SavingsAccount' (class): 0 attributes, 1 methods.
  • 'FixedDeposit' (class): 1 attributes, 0 methods.
  • 'Customer' aggregates 'Account' (holds).
  • 'SavingsAccount' inherits from 'Account'.
  • 'FixedDeposit' inherits from 'Account'.

Shape by shape

ShapeSymbolConnections
CustomerClassholds +customerNo int · → Account(holds)
AccountClassholds -balance long, +deposit(amount) void, +withdraw(amount) bool · ← Customer, SavingsAccount, FixedDeposit
SavingsAccountClassholds +transfer(to, amount) bool · → Account
FixedDepositClassholds +maturity Date · → Account

Symbols used here

SymbolMeaning
ClassA box with name, attributes and methods.
InheritanceSolid line from child to parent, hollow triangle at the parent.
AggregationHollow diamond at the whole; parts can live alone.

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.

# Bank account class diagram
classDiagram
  class Customer {
    +customerNo int
  }
  class Account {
    -balance long
    +deposit(amount) void
    +withdraw(amount) bool
  }
  class SavingsAccount {
    +transfer(to, amount) bool
  }
  class FixedDeposit {
    +maturity Date
  }
  Customer o-- Account : holds
  Account <|-- SavingsAccount
  Account <|-- FixedDeposit

More class diagram examples

All SeewolLabs tools