Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    Class BankAccount and class Person.Lecture 5 - slide 10 : 29
Program 8
using System;

public class BankAccount{   

  public BankAccount(){
     this.Balance = 0;
     this.Owner = new Person();   
  }                               
                                  
  public Person Owner {get; set;}
  public decimal Balance {get; set;}

  public override string ToString(){
    return Owner + "'s account holds " + Balance + " kroner";
  }
} 

public class Person {    
  public string FirstName {get; set;}
  public string LastName {get; set;}

  public override string ToString(){
    return FirstName + " " + LastName;
  }  
}
 
 
class BankAccount.
 
 
 
A BankAccount refers to a
Person object. This is important
for the example.
 
 
 
 
 
 
 
 
Class Person, which is used by BankAccount.