| csharp-3/object-initialization/BankAccount.cs - Class BankAccount - with two constructors. | Lecture 5 - slide 10 : 29 Program 4 |
using System;
public class BankAccount{
// automatic generation of private instance variables
public BankAccount(): this("NN") {
}
public BankAccount(string owner){
this.Balance = 0;
this.Owner = owner;
}
public string Owner {get; set;}
public decimal Balance {get; set;}
public override string ToString(){
return Owner + "'s account holds " + Balance + " kroner";
}
}