Play audio slide show -- Keyboard shortcut: 'x'  Lecture overview -- Keyboard shortcut: 'u'  Previous page: Eksempel: OOP (1) -- Keyboard shortcut: 'p'  Next page: Eksempel: OOP (3) -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home  Play sound for this slide -- Keyboard shortcut: 'y'    Introduktion til objekt-orienteret programmering - slide 29 : 31

Eksempel: OOP (2) 

 

Class Bank-konto
  private rentesats: Real;
  private balance: Kroner

  public balance(): Kroner
  public opret (init-beløb: Kroner)
  public hæv (beløb: Kroner)
  public indsæt (beløb: Kroner)
  public tilskriv-rente()
end Bank-konto
 

Class Check-konto : Bank-konto
  private antal-udskrevne-checks: integer
  public antal-udskrevne-checks(): integer
  public tilskriv-rente ()
  public clear-check(beløb: kroner)
end Check-konto