Source of StackInheritance.java


  1: // Fig. 17.10: StackInheritance.java
  2: // Derived from class List.
  3: package com.deitel.jhtp6.ch17;
  4: 
  5: public class StackInheritance extends List 
  6: {
  7:    // no-argument constructor
  8:    public StackInheritance() 
  9:    { 
 10:       super( "stack" ); 
 11:    } // end StackInheritance no-argument constructor
 12: 
 13:    // add object to stack
 14:    public void push( Object object )
 15:    { 
 16:       insertAtFront( object ); 
 17:    } // end method push
 18: 
 19:    // remove object from stack
 20:    public Object pop() throws EmptyListException
 21:    { 
 22:       return removeFromFront(); 
 23:    } // end method pop
 24: } // end class StackInheritance
 25: 
 26: 
 27: /**************************************************************************
 28:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 29:  * Pearson Education, Inc. All Rights Reserved.                           *
 30:  *                                                                        *
 31:  * DISCLAIMER: The authors and publisher of this book have used their     *
 32:  * best efforts in preparing the book. These efforts include the          *
 33:  * development, research, and testing of the theories and programs        *
 34:  * to determine their effectiveness. The authors and publisher make       *
 35:  * no warranty of any kind, expressed or implied, with regard to these    *
 36:  * programs or to the documentation contained in these books. The authors *
 37:  * and publisher shall not be liable in any event for incidental or       *
 38:  * consequential damages in connection with, or arising out of, the       *
 39:  * furnishing, performance, or use of these programs.                     *
 40:  *************************************************************************/