using System; // For the Console class. namespace DemoTypes { static class ClassesAndObjectsDemo { public static void DoDemo() { Console.WriteLine("ClassesAndObjectsDemo"); Console.WriteLine("------------------------------------------------------"); Account acc1 = new Account("Emily", 2000); acc1.Deposit(500); acc1.Withdraw(200); Console.WriteLine("{0}", acc1); } } public class Account { private string holder; private double balance; public Account(string holder, double balance) { this.holder = holder; this.balance = balance; } public void Deposit(double amount) { this.balance += amount; } public void Withdraw(double amount) { this.balance -= amount; } public override string ToString() { return this.holder + ", £" + this.balance; } } }