static void Main(string[] args) { Customer2 y = new Customer2("Tan Ah Kow", "20, Seaside Road", "XXX20", new DateTime(1989, 10, 11)); Customer2 z = new Customer2("Kim Lee Keng", "2, Rich View", "XXX9F", new DateTime(1993, 4, 25)); Account2 a = new Account2("001-001-001", y, 2000); Account2 b = new Account2("001-001-002", z, 5000); Console.WriteLine(a.Show()); Console.WriteLine(b.Show()); a.Deposit(100); Console.WriteLine(a.Show()); a.Withdraw(200); Console.WriteLine(a.Show()); a.TransferTo(300, b); Console.WriteLine(a.Show()); Console.WriteLine(b.Show()); int n1 = y.Age; Console.WriteLine(n1); int n2 = z.Age; Console.WriteLine(n2); }
private double balance; //Need to put private cos confidential info. REMEMBER ENCAPSULATION!!! //Constructor public Account2(string a, Customer2 b, double x) //When theres parameters. { acc_Number = a; acc_Name = b.Acc_Name; balance = x; }