Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'                bank-account/inheritance-1/lottery-account.cs - Constructors in class LotteryAccount.Lecture 7 - slide 24 : 40
Program 4

using System;

public class LotteryAccount: BankAccount {

   private static Lottery lottery  = Lottery.Instance(20);

   public LotteryAccount(string o, decimal b): 
     base(o, b, 0.0) {
   }

   public override void AddInterests() {
      int luckyNumber = lottery.DrawLotteryNumber;
      balance = balance + lottery.AmountWon(luckyNumber);
   }    

   public override string ToString() {
      return owner + "'s lottery account holds " +
            + balance + " kroner";
   }
}