Back to notes -- Keyboard shortcut: 'u'              Slide program -- Keyboard shortcut: 't'    Corrections of the errors in the illustration of static and dynamic types.Lecture 7 - slide 32 : 40
Program 1
class A {}
class B: A{}

class Client{
  public static void Main (){
                    // Static type    Dynamic type
    A x;            //    A              -
    B y;            //    B              -

    x = new A();    //    A            A   TRIVIAL
    y = new B();    //    B            B   TRIVIAL

    x = y;          //    A            B   OK - TYPICAL

    y = (B)new A(); //    B            A   RUNTIME ERROR
    y = (B)x;       //    B            B   NOW OK
  }
}