overloaded constructors
This commit is contained in:
@ -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!"
|
||||
|
||||
Reference in New Issue
Block a user