/*****************************************************/
// INHERIT0
// The following code is an example of a hierarchy 
// that classes might form.

// Create a bunch of classes:
   class A {}
   class B extends A {}
   class C extends A {}
   final class D extends B {} // $final$ prevents
   // class E extends D {}    //   inheritance

// Here is the Class Hierarchy:
//
//         A
//        / \
//       B   C
//       |
//       D
//
// + Note how you write superclasses above subclasses.
// + Draw links as arrows pointing upwards.
// + A superclass may have multiple subclasses,
//   but each subclass may have only ONE superclass.
// + Java does not have "multiple inheritance."

public class inherit0 {
    public static void main(String[] args) {

	B b1 = new B();
	A b2 = new B();    // pp 478-479
	// B b3 = new A(); // illegal! see pg 479
	
	// Using "built-in" method $getClass()$, which
	// returns the name of the actual class of the
	// object:

	System.out.println(b1.getClass());
	System.out.println(b2.getClass());

    }
}

/* output:
   B
   B
*/
