Back to notes -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    An illustration of dynamic type run-time check with v is C.Lecture 7 - slide 34 : 40
Program 1
using System; 

class App {

  public static void Main(){
  
    BankAccount ba1 = new BankAccount("George", 1000.0M, 0.01),
                ba2 = new CheckAccount("Bill", 2000.0M, 0.01);

    CheckAccount ca = new CheckAccount("John", 2000.0M, 0.01);

    if (ba1 is BankAccount)
      Console.WriteLine("ba1 is BankAccount");          
    else
      Console.WriteLine("ba1 is NOT BankAccount");

    if (ba1 is CheckAccount)
      Console.WriteLine("ba1 is CheckAccount");
    else
      Console.WriteLine("ba1 is NOT CheckAccount");


    if (ba2 is BankAccount)
      Console.WriteLine("ba2 is BankAccount");
    else
      Console.WriteLine("ba2 is NOT BankAccount");

    if (ba2 is CheckAccount)
      Console.WriteLine("ba2 is CheckAccount");
    else
      Console.WriteLine("ba2 is NOT CheckAccount");


    if (ca is BankAccount)
      Console.WriteLine("ca is BankAccount");
    else
      Console.WriteLine("ca is NOT BankAccount");

    if (ca is CheckAccount)
      Console.WriteLine("ca is CheckAccount");
    else
      Console.WriteLine("ca is NOT CheckAccount");

  }

}