From 137233e22fc518e99545dfff0737f6e4d2a2af6a Mon Sep 17 00:00:00 2001 From: janik Date: Mon, 15 Nov 2021 15:07:18 +0100 Subject: [PATCH] =?UTF-8?q?also=20non=20static=20=C3=BCberwei=C3=9Fen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 12fi5/AEuP/Konto/konto.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/12fi5/AEuP/Konto/konto.ps1 b/12fi5/AEuP/Konto/konto.ps1 index 4e7ad32..f3fc2cf 100644 --- a/12fi5/AEuP/Konto/konto.ps1 +++ b/12fi5/AEuP/Konto/konto.ps1 @@ -19,6 +19,20 @@ class konto { } } + ueberweissen([konto]$nach, [double]$menge) { + $stand_von = $this.guthaben + $stand_nach = $nach.guthaben + try { + $this.auszahlen($menge) + $nach.einzahlen($menge) + } + catch { + $this.guthaben = $stand_von + $nach.guthaben = $stand_nach + throw $_ + } + } + konto() { $this.guthaben = 0 $this.erstelldatum = Get-Date