// Featherweight Java examples class A extends Object { Integer x; A(Integer x) { super(); this.x = x; } A incr() { return new A(this.x+1); } } class B extends A { Integer y; B(Integer x, Integer y) { super(x); this.y = y; } A incr() { return new B(this.x+1, this.y+1); } } class Feath1 { public static void main(String[] args) { B b = (B) (new B(3,4)).incr(); System.out.println(b.x + " " + b.y); } }