/**
 * TestSuperSub.java works with Sub.java and SuperSub.java to demonstrate
 * superclass-subclass's data members and methods' visibility/access.
 *
 * Note: Since Super.java and Sub.java do not explicitly name the packages that
 * they belong to, that means they belong to the "unnamed" package; thus
 * essentially, they belong to the same package.  TestSuperSub.java belongs to
 * the same package as well.
 * 
 * CSCE 155 Fall 2005
 *
 * @author Leen-Kiat Soh
 * @version 1
 *
 */

class TestSuperSub  {

   public static void main (String[] arg)  {

      Super mySuper = new Super();
      Sub mySub = new Sub();

      int i;

      // which of the following is legal?
      
      i = mySuper.x;  // legal, correct
      i = mySuper.y;  // should be illegal according to book, why???
                      // this is because of the same package shared by the
                      // classes
      i = mySuper.z;  // not legal, correct


      // which of the following is legal?
     
      i = mySub.a;    // legal, correct
      i = mySub.b;    // should not be legal according to book, why???
                      // this is because of the same package shared by the
                      // classes
      i = mySub.c;    // not legal, correct

      // which of the following is legal?
      
      i = mySub.x;    // legal, correct
      i = mySub.y;    // should not be legal according to book, why???
                      // this is because of the same package shared by the
                      // classes
      i = mySub.z;    // not legal, correct

   }

}


