/* basic inheritance tests */ public class mainer { public static void main(String [] args) { doit(); System.out.println("done."); } public static inline void doit() { MyDerObj der1 = new MyDerObj(); MyDerObj der2 = new MyDerObj(4); MyDerObj der3 = new MyDerObj(4.2); MyImmut immut = new MyImmut(12); System.out.println(der1.foo()); der1.check(); der2.check(); der3.check(); immut.check(); } } class MyBaseObj { int Z = 0; public MyBaseObj() { Z = 99; } public MyBaseObj(int x) { Z = x; } public int foo() { return Z; } public inline void check() { System.out.println(Z); } } class MyDerObj extends MyBaseObj { int Y = 0; int Z = 666; public MyDerObj(double x) { this((int)x+2+foo()); Y = Y + 1; } public MyDerObj() { Y = 26; } public MyDerObj(int x) { super(x); Y = x; int z = super.Z; } public inline int foo() { return super.Z; } public inline void check() { super.check(); System.out.println(Y); System.out.println(Z); } } immutable class MyImmut { int A; public MyImmut() { this(0); } public MyImmut(int A) { this.A = A; } public inline void check() { System.out.println(A); } }