bank-account/bank-account-properties/disciplined-app.cs - A client of the disciplined BankAccount. | Lecture 5 - slide 7 : 29 Program 6 |
using System; class C{ public static void Main(){ BankAccount ba = new BankAccount("Peter", 1000); Console.WriteLine(ba); ba.Balance += 100; // read balance + deposit Console.WriteLine(ba); ba.Balance -= 300; // read balance + withdraw Console.WriteLine(ba); decimal amount = ba.Balance; // read balance ba.Balance = amount + 100; // deposit Console.WriteLine(ba); ba.Balance = 400; // illegal deposit Console.WriteLine(ba); } }