class A {
  Integer fieldA

  void methodA (Integer x) {
    out.println("methodA")
  }
}

class B ext A {
  Integer fieldB

  void methodA(Integer x) {
    out.println("overridden methodA")
  }

  void methodB(Integer x) {
    out.println("methodB");
    this.methodA(null);
    out.println(this.fieldA);
  }
}

class X {
  A a
  B b
  A a2

  void main(X x) {
    out.println("start x");
    x.a := new A;
    x.b := new B;
    x.b.fieldA := 25;
    x.a.fieldA := 75;
    x.a.methodA(null);
    x.b.methodA(null);
    x.b.methodB(null);

    x.a2 := new B;
    x.a2.methodA(null);
    out.println("end x");
  }
}
