class B {                 // Base (Parent) class
    void f() {
        System.out.println ("f() in B");
        g();
    }
    void g() { System.out.println ("g() in B"); }
    void h() { g(); }
}

class D extends B {      // Derived (Child) class
    void f() {
        System.out.println ("f() in D");
        g();
    }
    void g() { System.out.println ("g() in D"); }
    
}

public class Test {
    public static void main (String[] arg) {
        B b  = new B();   // Pure Base
        b.f();   b.g();

        D d  = new D();   // Pure Derived
        d.f();   d.g();

        B bd = new D();   // ??
        bd.f(); bd.g();
        bd.h();           // Surprised ??
    }
}