Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'        Slide program -- Keyboard shortcut: 't'    A client of Accounts.Lecture 5 - slide 15 : 29
Program 5
using System;

class Client{

  public static void Main(){
 
     Accounts acc = new Accounts();

     Person p1 = new Person("Peter"),
            p2 = new Person("Marie");

     acc[p1] = new BankAccount(0.02, 1000);  
     acc[p2] = new BankAccount(0.03, 5600);  

     Console.WriteLine(acc[p1]);             
                                             
  }

}
 
 
 
 
 
 
 
 
 
 
 
We set p1's and p2'2 bank accounts to 
newly created BankAccount objects.
 
We use the index getter to access
p1's bank account.