Methods with value parameters in class BankAccount. | Lecture 5 - slide 21 : 29 Program 1 |
using System; public class BankAccount { private string owner; private decimal balance; public BankAccount(string owner, decimal balance) { this.owner = owner; this.balance = balance; } public decimal Balance { get {return balance;} } public void Deposit(decimal amount){ balance += amount; } public void Withdraw(decimal amount){ balance -= amount; } public override string ToString() { return owner + "'s account holds " + + balance + " kroner"; } } |