From 7ac9e38d45997390af77e63cbd43bdc88967fcc0 Mon Sep 17 00:00:00 2001 From: janik Date: Thu, 21 Oct 2021 12:43:48 +0200 Subject: [PATCH] overloaded constructors --- 12fi5/AEuP/Konto/konto.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/12fi5/AEuP/Konto/konto.ps1 b/12fi5/AEuP/Konto/konto.ps1 index 35d0aaf..18ba1a1 100644 --- a/12fi5/AEuP/Konto/konto.ps1 +++ b/12fi5/AEuP/Konto/konto.ps1 @@ -3,13 +3,26 @@ class konto { [string]$ktyp [string]$kunde [double]$guthaben - [string]$erstelldatum + [datetime]$erstelldatum konto() { $this.guthaben = 0 $this.erstelldatum = Get-Date } + konto([string]knr) { + $this.guthaben = 0 + $this.erstelldatum = Get-Date + $this.kontonr = knr + } + + konto([string]knr, [string]ktyp) { + $this.guthaben = 0 + $this.erstelldatum = Get-Date + $this.kontonr = knr + $this.ktyp = ktyp + } + [double]einzahlen([double]$menge) { if ($menge -lt 0) { throw "Einzahlungsmenge muss positiv sein!"