Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'        Slide program -- Keyboard shortcut: 't'    A client of class BankAccount with nested object initializers.Lecture 5 - slide 10 : 29
Program 9
using System;

public class Client {

  public static void Main(){
    BankAccount ba1 = new BankAccount{ 
                            Owner = {FirstName = "James",       
                                     LastName = "Madsen"},      
                            Balance = 250},   

                ba2 = new BankAccount{  
                             Owner = {FirstName = "Bill",       
                                      LastName = "Jensen"},
                             Balance = 500};

    Console.WriteLine(ba1);
    Console.WriteLine(ba2);
  }

}
 
 
 
 
 
 
A nested object initializer.
Only initialization - not Person instantiation.
 
 
 
Another nested object initializer.