Tutorial and lab prep for week 12
---------------------------------

Read chapter 14 from the Nino and Hosch text.

Answer question 14.2 and complete the rest of this page.

Write the headers (e.g. "class X ...") for the classes in the
following hierarchy:

    A
   / \
  B   C
 / \ /
 E F G

Suppose that for the hierarchy above:

- A defines "public void goodbye()"
- B defines "public void hello()"

Which of the following will compile?

__ A a = new A(); a.goodbye();

__ A a = new B(); b.goodbye();

__ A a = new B(); a.hello();

__ B b = new B(); b.hello();

__ A a = new B(); ((B)a).hello();

__ B b = new A(); b.goodbye();

__ A a = new F(); a.goodbye();

Suppose that for the hierarchy above:

- C defines "private void hello()"
- B defines "public void percolate()"

Which of the following will compile?

__ A a = new C(); a.hello();

__ C c = new C(); c.hello();

__ [inside C] public void simmer() { hello(); }

__ [inside G] public void simmer() { hello(); }

__ [inside A] public void simmer() { super.hello(); }

__ [inside G] public void simmer() { super.hello(); }

__ [inside G] public void hello() { super.hello(); }

__ [inside F] public void percolate() { super.percolate(); }